Macro Group Name Given a UUID?

Given a UUID for a macro group (or smart group), is there a way to get the group name?

For macros, I see MacroNameForUUID, but there doesn't seem to be a corresponding token for macro groups (and smart groups) names. Is there another method to get the name?

I'm am able to generate a list of group and smart group UUIDs using this:

tell application "Keyboard Maestro"
	set GroupList to id of every macro group
	set SmartList to id of every smart group
end tell

set combList to GroupList & SmartList as list

set text item delimiters to linefeed
return combList as text

And I can get a list of the names using this:

tell application "Keyboard Maestro"
	set GroupList to name of every macro group
	set SmartList to name  of every smart group
end tell

set combList to GroupList & SmartList as list

set text item delimiters to linefeed
return combList as text

But I suspect one can't assume these two lists are in the same order.

From the Wiki entry for MacroNameForUUID Token:

This token returns the name of the macro or macro group with the specified UUID.

1 Like

You inspired me. The following macro puts a comma-separated list of all group names and their UUIDs on the clipboard:

Get KBM group name for ID Macro (v10.0.2) -edited to remove unnecessary step

Get KBM group name for ID.kmmacros (4.4 KB)

2 Likes

Very nice! I don't often need UUIDs since most of the time I enable/disable macros and groups via the native KM action. But there are times when I want to do that from within an AppleScript and having a quick way to look them all up can be very handy for that. Thanks for building this and sharing!

1 Like

@DanThomas and @rolian, thank you very much for the replies.

I saw and tried that. My screw up was I somehow missed the Process Tokens action. My eyes skipped right over that detail. :flushed:

Glad I could provide the inspiration. :wink: I missed the Process Tokens action in the Wiki, but not in your example. Thanks for taking the time to share the macro. :grinning:

1 Like

LOL. I missed the Process Tokens part too at first - I was trying all different combos of % signs with the UUID token before I decided maybe I should read the whole Wiki page.

2 Likes