I have about 5,000 macros many with similar names. I extensively use palettes, nested palettes, conflict palettes, obviously many keyboard shortcuts and the trigger macro by name action.
Based on my experience with Alfred and LaunchBar, I have come to like using a search bar and a search by keyword. A keyword is short with a mnemonic component, a far cry from the descriptive name of a macro. In addition, in terms of workflow, there is something to be said in favour of keeping one's hands on the keyboard, as opposed to palettes and stretching out one's fingers to type a keyboard shortcut.
I tried adding distinctive keywords to macro names, such as $img50 for the macro that resizes the image in the clipboard by ↓ 50%, and searching for it with the trigger macro by name action, but despite the uniqueness of $img50, I end up with too many results I have to sort through before I can trigger the macro.
What would be the best was to create a rapid search for macro by keyword macro ?
Assuming that the answer is to use the trigger macro by name action and a keyword in the macro name, how should I structure the keyword.
Let's say that my keyword is img50 that I would add at the end of the macro name and don't want it at the beginning of the macro name (would make reading palettes too difficult).
Is it OK to use @img50 as a keyword and could that formulation create problems for me down the line forcing me to one day edit out all the @ symbols. Or are other symbols preferable ?
Could you start by reducing the number of macros? For example:
...suggests you have multiple macros that differ only in the resize amount -- you could replace them all with a single macro that prompted with a list of resize percentages.
If you want to use tags then I've just had a play and you might be able to make use of Notes. You can apply these to any action via its Settings cogwheel but, for consistency, I'd suggest starting your macros with a "Comment" action which you apply the Note to. Put your tag in the Note and you shouldn't have any problems using @ symbols etc.
You'd then "Trigger Macro by Name" with an initial search of "note":
Main downside is that, as noted another threads, the initial search text is selected when the prompt appears -- so you'll have to right-arrow to start adding the tag to search for.
Maybe not...
Here's a quick demo. You run the "Trigger" macro which asynchronously fires off the "Prompt" macro, waits until it is on the screen (you may have to change the image it waits for to suit your setup), then types in note: and is ready for your tag text.
Three other macros included, each with "Comment" with a Note -- @1, @2, and @3 respectively -- which you can search for and run from the prompt.
I don't know if this is a good idea and haven't tested it, but have you ever thought of creating nested "Trigger Macro by Name" actions?
Many (10, 20?) of these actions are triggered by the same shortcut. So you get a conflict palette. For example this
Each of these "Trigger by Name" actions can have a different predefined prefix / keyword (and/or a macro group) that narrows down the search, but you don't have to type it every time.
Thanks very much for the macro and the suggestions.
I played around with both and find it too time consuming. I think that I will go with @Frankb 's suggestion, but once again I am very grateful for your time and ideas.
Whether you add a "tag comment" or append text to the macro name, it'll take time. But with a bit of AppleScript you can select one or more macros, pop a dialog for each asking for a tag to use, then add the action as described earlier.
AppleScript
tell application "Keyboard Maestro"
set macroList to (get selected macros)
repeat with eachMacro in macroList
set theTag to text returned of (display dialog "Set the tag for macro \"" & name of eachMacro & "\"" default answer "")
set theXML to "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>ActionName</key>
<string>Holds tag Note</string>
<key>ActionNotes</key>
<string>" & theTag & "</string>
<key>IsDisclosed</key>
<false/>
<key>MacroActionType</key>
<string>Comment</string>
<key>StyledText</key>
<data>
cnRmZAAAAAADAAAAAgAAAAcAAABUWFQucnRmAQAAAC5uAAAAKwAAAAEAAABmAAAAe1xy
dGYxXGFuc2lcYW5zaWNwZzEyNTJcY29jb2FydGYxNDA0XGNvY29hc3VicnRmNDcwCntc
Zm9udHRibH0Ke1xjb2xvcnRibDtccmVkMjU1XGdyZWVuMjU1XGJsdWUyNTU7fQp9AQAA
ACMAAAABAAAABwAAAFRYVC5ydGYQAAAAd3KjV7YBAAAAAAAAAAAAAA==
</data>
<key>Title</key>
<string>To hold tag Note</string>
</dict>
</plist>
"
tell eachMacro
set newAction to make new action with properties {xml:theXML} at beginning of actions
end tell
end repeat
end tell
You can run it from Script Editor/Script Debugger or, of course, from a KM macro:
@ronald Can you already roughly estimate whether the idea with the palette of different ".. by Name" macros could be practical? Maybe I will do that too if you explain how you did it.
I was playing around with different apps and found the solution. An Alfred workflow which emulates the KM trigger macro by name macro and gives instantaneous results.