Run macros in a group sequentially and one group after another

AppleScript
use application "Keyboard Maestro"
use application "Keyboard Maestro Engine"

set uuid to getvariable "Input" -- The id of this macro
set _M to a reference to (every macro in every macro group whose id ≠ uuid)

repeat with M in the id of _M -- Loop through all macros in all macro groups
	try
		do script M -- Run the macro
	on error E
		log E -- Log any errors to display at the end
	end try
end repeat

Run Every Macro.kmmacros (16.0 KB)


If I've understood you correctly, you basically wish to run every macro in Keyboard Maestro in turn. I cannot see what order you have your macros in; hopefully they are ordered by name, and this is the order you wish them to be run in.

The AppleScript action in this macro retrieves every macro in every macro group, and it appears to be reliable on my system in returning this list ordered first by macro group name, and then by macro name, i.e.

Macro Group A
    Macro AA
    Macro AB
    Macro AC
    ...etc.
Macro Group B
    Macro BA
    Macro BB
    Macro BC
    ...etc.
...etc.

Then it simply works its way down the list of macros and executes them one-by-one.

Note: I haven't tested this macro on my system, because I don't fancy running every macro I have (doing so would be disastrous for me). That said, it's a very straightforward script, so I don't anticipate any problems.