Macro searching by trigger

Is there a way to search macros based on trigger (specifically Hotkey)?
E.g. I want to find all my macros that include the modifiers ⌘⇧⌥ in the hotkey trigger.
Typing one or more glyphs in the search filed or in a smart group criterium doesn’t work (the search is not limited to the trigger and actually I’m not completely clear about the scope of a search).

On a side note: while playing with smart groups I mangled the “All Macros” filter. It should be “all:” but just want to be sure, is that correct?
It would be probably safer (to users like me at least :grinning:) to have an unchangeable “All Macros” group like we have a default “Global Macro Group”, a place where you’re sure you can see/select/export all of your macros.

Hey @johseb,

Unfortunately there is not a token to specify a hotkey trigger search. (Personally I'd love to see Peter add one.)

BUT searching for the correct glyphs should generally get you there:

M

M

When I first started testing this I found I had an incorrect glyph for Control, but once I fixed that the search field and smart searches responded just fine.

Search is restricted to the selected macro-groups.

Smart Searches are global unless you tell them otherwise:

group:"Global Macro Group" ⌃⌥⇧⌘

Searches will find macros where the given character glyphs show up in actions in addition to macros where they are part of the trigger string, so you may end up with a false-positive or three – but there shouldn't be too many.

Another tip for searching when you don't know where a macro is..

  • Activate the macro.
  • Go to the All Macros group.
  • Sort by Date Used.

Yes.

-Chris

Hi Chris,
thanks for your reply.
I think I spotted the problem: I wasn’t separating the glyphs with a space.
“⌘⌥⌃” doesn’t return nothing while “⌘ ⌥ ⌃” seems to work (still have to check and in any case I have a lot of false positives).
The search operate on macros only so you also miss the hotkeys used to open group palette in case you’re doing a search, as I am, to see which hotkeys are already assigned.

I agree that would be nice to see an improvement in this area.

PS
I’m using the following Unicode entities (decimal codes)

8984 ⌘ Command
8963 ⌃ Control
8997 ⌥ Option (Alt)
8679 ⇧ Shift

Glyph	Unicode
⌃	2303
⌥	2325
⇧	21E7
⌘	2318

And how did I figure this out?

I used the Tripped Trigger token and saved it to the clipboard using a Set Clipboard to Text action.

The returned text:

The Hot Key ⌃⌥⇧⌘M is pressed

-Chris

The glyphs don't need to be separated by spaces – nor do they need to be in any particular order.

-Chris

Yes, we're using the same glyphs; you listed them using Hex codes while I used the Decimal ones.

As for the separating spaces I'm a bit confused; I got completely different results with or without them (see screenshots when using only two of them).

The problem is that there is a canonical order for the modifiers for the hot keys, specifically:

⌃, then ⌥, then ⇧, then ⌘

Keyboard Maestro, being astoundingly clever (ok, really just being at version 7 and developed over many years with many small improvements) automatically orders your search in the macro search field in the canonical order. So when you search in the main search field, for "⌘⇧⌥", Keyboard Maestro actually searches for "⌥⇧⌘".

Unfortunately, this extra bit of intelligence is not in the Smart Groups search (until the next version!), so a Smart Group search for ⌘⇧⌥ will generally find nothing, whereas a smart group search for ⌥⇧⌘ will find what you are looking for.

Unfortunately, that is true of the main search filter, but not the smart groups (for now).

I have added canonicalising code to the Smart Groups search, and I will see if I can add a trigger: search tag, and some way to stop the All Macros Smart Group from being modified.

This I can't do much about, search will not search for macro groups.

Thank you Peter, the canonical order is working fine.
I “solved” the point about macro groups adding the hotkey at the end of the name.

I have added trigger: and hotkey: filters for the next version.

hotkey: searches only the text of the actual key (short or long format).

trigger: searches the text of any trigger (eg the trigger description).

Both allow specifying of any of the modifiers and will find any trigger that has at least those modifiers.

3 Likes

Hey Peter,

What about adding a lock checkmark to smart-searches?

That would prevent someone from accidentally changing a locked search.

-Chris

Yes, I was thinking along those lines. That or just making the All Macros one locked. Not sure which yet.

How about a “name:” filter that limit the search to the name of the macros?

1 Like

Done for the next version.

1 Like

Hey Peter,

All Macros should always be there (in my opinion), so it would be reasonable to make it completely static.

-Chris

Done for the next version.

Many, if not all, requests made in this topic have been implemented in a later version of Keyboard Maestro.

As of Keyboard Maestro 7.3.1 (and probably prior), Macro Search has been greatly enhanced.
###See Macro/Group Search Filters [Keyboard Maestro Wiki]


@johseb,

If this post, or others posts here, solves your problem/question as originally stated, please check the ["Solved" checkbox](https://forum.keyboardmaestro.com/t/new-forum-feature-question-solved-or-best-answer/4114) at the bottom of that post.

Otherwise, please post your remaining questions/issues about this problem.
If you have other questions, please start a new topic.