Programmatically Open Macro in KM Editor

I have an external script that uses AppleScript to list all my macros and trigger them. Is there a way to open the macro in the Keyboard Maestro editor instead of triggering it? I tried to look for this in the AppleScript dictionary but wasn't sure if this is possible

How about this?

Yes. The AppleScript is very simple:

tell application "Keyboard Maestro"
  editMacro "Macro Name or UUID"
end tell

You can also pass a Macro Name or its UUID into the AppleScript by using a Keyboard Maestro Variable something like this:

EXAMPLE Open Macro In Editor with AppleScript.kmmacros (3.1 KB)

set kmInst to system attribute "KMINSTANCE"
tell application "Keyboard Maestro Engine"
  set MacroToEdit to getvariable "LOCAL__Macro Name" instance kmInst
end tell

tell application "Keyboard Maestro"
  editMacro MacroToEdit
end tell
1 Like