Execute Macro Action Supersedes Macro Disabled Status?

Hi. This is my first post on the forum, but I've been using Keyboard Maestro for about a year now.

I quite often have to modify the actions of macros that I use on a regular basis to suit the specifics of the project that I'm working on. In most cases, I need to disable a set of actions within the macro that aren't needed.

In the past, I've color-coding sets of actions to organize them and manually disabled them.

I had the idea today of splitting these actions out into a separate macro and then calling them in the original via Execute Macro. I figured that if I disabled the secondary macro, the Execute Macro action couldn't proceed and those actions would be skipped over, but this doesn't seem to be the case.

Is there a setting that I'm missing or a more straightforward way to control which actions within a macro are enabled/disabled?


I can confirm that behavior.

@peternlewis, IMO this is a bug, which I reported a couple of years ago.

Any macro that is disabled should NOT be able to be executed from any source.

AFAIK, there is nothing you can do to change this errant behavior.

However, you can workaround it.
Create a Global Variable for each of these sub-marcros that you have been disabling, and set it to either "ENABLED" or "DISABLED" when you want to change the status.
Then, in the Sub-Macro, do an IF/THEN test on that Global Variable.

Here is one approach:

Put this at the top of the Sub-Macro:

where "Macro_A" is an ID you will use for this Macro.
NOTE that the Cancel is for "Just This Macro".

So you could then change this Global Variable either by another Macro, or by using the KM Editor Preferences > Variables panel.

Yes, this is behaving as designed.

Originally I was on the fence on this, but now I am definitely moving in this direction.

Disabling a macro disables all its triggers, as well as any implicit triggers (such as within a macro group or a web trigger), but it can still be executed explicitly, by Execute a Macro and via executing the macro explicitly via its UUID in AppleScript (not sure if I have implemented that, but that is my design intention).

If you want to disable a macro even from this sort of intentional explicit execution, add a Cancel Just This Macro action to the front of it or otherwise disable its behaviour.

Please consider this thread locked as far as any further discussion on the pros and cons of this policy (ie, don't make me actually lock it), but feel free to discuss alternative ways of disabling the actions within the macro if desired.

Thanks for the suggestion. Definitely adds a little more complexity to the problem, but it's a good solution!