How to automate moving selected macro(s) into KM group instantly

I have macro selected like this:

I want to press keybind and it will instantly move the macro into Global Macro Group. How can I do this?

You could do it with a macro that cuts (Cmd-X) the selected macro, then selects the global macro group (View > Select Groups Column), then select the global macro group by having your macro type "g - l - o etc". Once selected, Paste (Cmd-V) the macro. I obviously didn't try to write this, but I think it'd work.

The other option is AppleScript, which is what I used in this macro that moves and renames macros. (I didn't write that AppleScript, I found it elsewhere here on the forums.)

-rob.

1 Like

Try this, after setting the hotkey trigger to whatever you want -- it'll move all selected macros into the Global Macro Group:

Move Selected Macros to Global.kmmacros (1.8 KB)

2 Likes

Ok above works.

@Nige_S works too but it doesn't switch to the group (is great too)

I wonder if there is solution like:

tell application "Keyboard Maestro"
	repeat with eachMacro in (get selectedMacros)
		move macro id eachMacro to macro group "Global Macro Group"
	end repeat
end tell

That also switches and focuses on macro similar to automating keystrokes.

Because you didn't ask for that! :wink: You just need to add the selection of the group at the end:

tell application "Keyboard Maestro"
	repeat with eachMacro in (get selectedMacros)
		move macro id eachMacro to macro group "Global Macro Group"
	end repeat
    select macro group "Global Macro Group"
end tell

If you want to have the macro that's just been moved selected at the end you'll need to limit yourself to only moving one macro (you also have to select the Global group to prevent UI weirdness):

tell application "Keyboard Maestro"
	set theList to (get selectedMacros)
	if (count of theList) is not 1 then
		display dialog "Select one, and only one, macro to move"
		return
	end if
	set theMacro to item 1 of theList
	move macro id theMacro to macro group "Global Macro Group"
	select macro group "Global Macro Group"
	select macro id theMacro
end tell
1 Like

gorgeous, thank you :heart_eyes_cat: