'Execute Macro' by Name in a Variable

Instead of the built-in Execute a Macro action, you can run a macro via AppleScript. As an example, this macro:

image

tell application "Keyboard Maestro Engine"
	set MacroToRun to getvariable "ThingToDo"
	do script MacroToRun
end tell

executes this macro:

image

which produces this result:

18%20AM

With this method, you could set the variable naming the macro-to-be-run however you like, then either replace your current "IF ELSE" based macro with one consisting of this single Execute an AppleScript action and run it as a sub-routine with an Execute Macro action, or just add the AppleScript action in an appropriate location for each macro that sets the variable it uses.

9 Likes