I have a Keyboard Maestro Macro that gets the UUIDs of all top-level groups in all open databases, which I then massage to create a dictionary in KBM that is called by various Stream Deck triggers. The relevant part of the KM macro is the following AppleScript that was cribbed from this forum (I will amend this post when I figure out who to thank/credit):
set masterList to {}
tell application id "DNtp"
set allDatabases to every database
repeat with thisDatabase in allDatabases
set dbName to name of thisDatabase
set allGroups to (every record of thisDatabase whose type is group)
set groupList to {}
repeat with thisGroup in allGroups
set groupName to name of thisGroup
set groupUuid to uuid of thisGroup as string
if groupName is not in {"Trash", "Tags"} then
set tempList to "{ \"group\" : \"" & groupName & "\" , \"uuid\" : \"" & groupUuid & "\" }"
if groupList = {} then
set groupList to tempList
else
set groupList to groupList & "," & tempList
end if
end if
end repeat
if groupList ā {} then
if masterList = {} then
set masterList to groupList
else
set masterList to masterList & "," & groupList
end if
end if
end repeat
set masterList to "[" & masterList & "]"
end tell
set saveTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to {","}
set masterList to masterList as string
set AppleScript's text item delimiters to saveTID
return masterList
I would love to be able to extend this to obtain the UUIDs of subgroups, even if meant doing so on a database by database basis. That is, I only have fewer than a dozen databases that I need to put in the KM dictionary and my group names are fairly static, so if I run the above script to get top level groups and need to run another script or scripts to go database by database (or worst case, group by group) that would be fine for my purposes.