A Macro That Triggers All Macros In A Group (Possible?)

Hi, I'm not sure if this topic was addressed. I couldn't find it when I did a quick search. Is it possible to create a macro that triggers every macro in a macro group - besides using the obvious time consuming strategies. I have a group with about 40 macros and I'd like to trigger them in quick succession with one macro. The best solution I've been able to come up with: Programmatically placing the KM Editor in Full Screen, programmatically placing the cursor at the arrow that triggers any one macro (see pic below) - using an action to press down on the arrow (see pic) after using type a key stroke/arrow down - and go through each of the forty macros. This isn't a pretty way of doing it. Was wondering if anyone had a better method. Thanks.

Screen Shot 2019-05-15 at 12.00.54 AM
54%20AM

Yes, there's a much better way. Try dropping this script into an Execute an AppleScript action, after replacing "Test" in the tell its macro group "Test" line with the name of the macro group in question:

tell application "Keyboard Maestro"
	tell its macro group "Test"
		set MacroList to id of every macro
	end tell
end tell

tell application "Keyboard Maestro Engine"
	repeat with i from 1 to (count of MacroList)
		set MacroToRun to item i of MacroList
		do script MacroToRun
	end repeat
end tell

The resulting macro should look like this (note that you may need to toggle the macro editor's editing mode to get the fancy colored text formatting):

image

While one of the scripting gurus here may have an even better way of doing this, this method works in my testing and should at least be much more preferable to simulated down arrow key strokes.

1 Like

Hey, thanks for this. I know applescript well enough to know, your script should work but after a half hour of fiddling, no dice. :disappointed: I tried throwing it into a new AS doc, compiling it & putting it back into KM but it didn't work. Anyway - on a different but related note - your reply inspired me to fiddle with KM jsut for the fun of it (I'm usually work oriented). I created a macro group called 'no_value' and a website with the same name. Then I tried your script on a group with three macros, each one programmatically takes a screenshot of /3 of my monitor...oh well...I better get on with something that has value...I would hate to fool around with KM just for the fun of it :smile: Screenshot of my no_value website below.

PS
By the way, it's a good thing my alzheimer's kicked in - I forgot why I asked the question in the first place - otherwise, it wouldn't have been as much fun, trying to get it to work. Also, y

ou say you tested it, and it worked. Was your script inside the target macro group...a shot in the dark, thx again, my friend ....see ya

Scratch my last reply: Your script works! fantastic! (I placed it into script editor, ooked at the result and as it turns out, the culprit was a typo I made... Thanks for this!

1 Like