Run macros in a group sequentially and one group after another


What I have;
Multiple groups containing macros.
Individual macros contain combination of macros and actions.
What I need to achieve;
Run groups sequentially.
Run macros in a group sequentially.

I have 523 macros (some are duplicates in multiple groups).
I am not activating/deactivating macros anywhere.
I don't have any triggers.

My macros are mainly writing and sending emails.
Here is an example snippet of "Send email";
Start Log
-- Append Text to a file located in ....
-- If succeeded then move on, else log failure and cancel %ExecutingMacro%.
Open Outlook
-- Bring application to front.
-- If succeeded then move on, else log failure and cancel %ExecutingMacro%.
Create a new mail
-- Execute keystroke
-- If succeeded then move on, else log failure and cancel %ExecutingMacro%.
And so on....

I know I can create a macro containing all the macros, let's say it's called "Umbrella", I need to run sequentially, then run that macro.
However, if I do that, then %ExecutingMacro% in the failure log message becomes "Umbrella", not "Send email". So I can't do that.

I looked at "trigger" but I didn't find a trigger that works for running hundreds of macros one after another.
I don't know anything about apple or java script so I couldn't do anything outside of what the application provides by default (which to me again, it didn't look like one trigger will do the job).

Any tip would be appreciated.
Thank you.

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
		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
Macro Group B
    Macro BA
    Macro BB
    Macro BC

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.