Buildup of macros running

Hi all,

Just now I received this in the log file:

2018-05-27 13:34:27 More than 50 simultaneous macros - aborting everything

Clearly despite my best intentions I am allowing macros to buildup in the background somewhere. I am running a series of about 10 macros in sequence. The tail of each triggers the beginning of the next. The final one triggers the first one again and so on it goes.

I'm wondering- how could I be building up all these macros? I had previously thought that I had written things nicely but now its clear to me that this is not the case. Should I search for the elegant solution- or just issue some sort of "cancel all but this macro" at the start of each macro? I have some learning to do here!

Assuming you're using the Execute a Macro action to have each macro run the next macro, if you don't set the executed macros to run asynchronously, the "parent" macro will remain active until the macro it executes completes; I'm guessing this is what's happening in this case. If that doesn't seem to be the issue, you'll need to post an actual macro or two, if not the whole set, so we can see for ourselves how you have them set up.

1 Like

Thank you @gglick! I'll write back when I have absorbed this and tried it out. I will read up on asynchronous execution also.

1 Like

Hi @gglick,

Indeed my chain of macros were all set to launch synchronously, I switched them all to asynchronous and for the first time last night my computer worked through the night! Thank you very much. Some learnings for me here:

-The log file and the debugger are very useful!
-I thought KM ran pretty strictly in series one macro at a time and one after another, but now I see it is far more powerful than that.
-I understand now that there can be all sorts of macros executing alternately/simultaneously or in complex orders which I really find quite amazing.

May I ask, do you often work synchronously when you are writing macros? I can sort of sense the implications of what it might make possible but can't imagine working that way myself at my current skill level.

https://wiki.keyboardmaestro.com/action/Execute_a_Macro

The relevant wiki entry for anyone who is interested.

Glad my tip proved useful. KM's depth is indeed exceptional, but for my own cases, I don't generally use any long-running sequences of macros, but rather one-and-done macros that perform one or two functions and then go away. Some of my macros do make use of "sub-routine" macros in order to recycle code or make it easier to change how several macros run by editing the key sub-routine, and I've certainly made use of the asynchronous functionality that way, but having a string of ten macros running and calling one another like this is beyond anything I've personally found a use case for. Hopefully this answers your question!

1 Like