Selecting a combination of Smart Groups and Macro groups via Applescript

I have a macro that exports specific macro groups to create a new version of a macro set to distribute to my colleagues. I'm trying to add a smart group to this macro set and having trouble with the applescript to select both the macro groups and smart group(s).

tell application "Keyboard Maestro"
	activate
	select (macro groups whose name contains "HC" and name does not contain "Installer")
	select (smart groups whose name contains "HC" and name does not contain "Installer")
end tell

This script selects the correct groups sequentially, but I can't figure out how to additively select macro groups and smart groups via applescript. I tried:

tell application "Keyboard Maestro"
	activate
	select (macro groups whose name contains "HC" and name does not contain "Installer") & (smart groups whose name contains "HC" and name does not contain "Installer")
	
end tell

As well as

tell application "Keyboard Maestro"
    activate
    set selectedGroups to (macro groups whose name contains "HC" and name does not contain "Installer") ¬
        & (smart groups whose name contains "HC" and name does not contain "Installer")
    select selectedGroups
end tell

After some forum searching... I found @CRLF 's macro which looks like i can use to accomplish what i'm looking for!

I think it's a class/reference issue -- with the combined lists select isn't getting what it can understand.

You can get round it by setting the selection instead, eg:

tell application "Keyboard Maestro"
	set theGroups to (every macro group whose name contains "Test")
	set theSmarts to every smart group whose name contains "Enabled"
	set the selection to every item of (theGroups & theSmarts)
end tell
1 Like