Continuing the discussion from How to set a keybinding to enable/disable action / multiple actions?:
Scripting the Keyboard Maestro editor (KM Wiki)
It took me a bit of time to figure this out.
I thought the command:
set macroList to selectedMacros
would give me a list of Macro objects.
But it does NOT. It just returns the UUID for each of the macros.
So here's how I got the current macro object:
tell application "Keyboard Maestro"
# Ver 1.1 2017-09-20
set macroList to every macro whose selected is true
--- Make Sure Only ONE Macro is Selected ---
if ((count of macroList) = 1) then
set oMacro to item 1 of macroList
else
error "Multiple Macros are selected. Select only ONE and re-execute this script."
end if
--- Now We can Get/Set Macro Properties ---
set macroName to name of oMacro
return macroName
end tell
Properties of a Macro Object
from Script Debugger 6
If anyone has some good example scripts, please share.