I quickly navigate between KM macro groups using the macro below.
It works very well . I created a hotkey for a KM "Go To" palette, and that palette contains a series of macros navigating to different groups. It saves a lot of time compared with scrolling and clicking around.
My problem is that only "normal" macro groups seem to have a UUID, not smart groups. For smart groups, I tried to take the "long route" by going through the menu as per below. It works but is slow.
My question is do smart macro groups have a UUID, or is there an equivalent apple script to navigate to them ?
This AppleScript will give you the name and id of the selected group. Just make sure you select a group first:
tell application "Keyboard Maestro"
set MySelection to selection -- get selection
set sGroup to item 1 of MySelection -- get first item of selection
set sGroupID to id of sGroup -- get ID of selected group
set sGroupName to name of sGroup -- get name of selected group
end tell
You can reference a group by name or id:
tell application "Keyboard Maestro"
activate
editMacro "Group Name" -- name of the group instead of id 31244526-8D7B-46EC-AAOA-DE3DA5857689 in your screen shot
end tell
This AppleScript is very helpful because just today I wanted to write one to retrieve the names of every macro inside a smart group... but for some reason even though this script will give me the smart group's UUID, when I use that in the following AppleScript I get an error...
AppleScript to get list of macros names (click to expand/collapse)
--for debugging: test macros
set macroGroupID to "0E6959AD-478C-493F-B4CF-C55BC7E97037" --Test Macros
set macroGroupName to "Test Macros"
--for debugging: Smart Group: macOS Shortcuts
set macroGroupID to "7B1B3AD5-B099-47F5-8C50-3C33D6556717"
set macroGroupName to "Smart Group: macOS Shortcuts"
tell application "Keyboard Maestro"
tell its macro group macroGroupName
set MacroIdList to id of every macro
set MacroNameList to name of every macro
end tell
end tell
Screenshot: Script Debugger error message (click to expand/collapse)
That's a tough one. I suspect it is because each macro "belongs" to a macro group, not a smart group. If you look at the xml for a given macro, you will see its macro group. So I am guessing it has to do with that underlying data, not how they are displayed in the editor.