Enhancement for Kill all macros like really pause all macros except some from a list - is that possible?!

Hello Folks :wave:

First of all - having an action like Kill all Macros is totally awesome :star_struck:

And - I really love it - I can not say how much time and trouble it has saved me during the last years when something tended to go totally wrong.

But there is some kind of trouble it comes with that sometimes bites me too often … the killing of automated Time Machine Backups or creating local snapshots, automated ram cleaning with a dedicated App … switching contexts … you get it … a lot of possibilities of Macros which could get in the way and the fact that they will get killed, too but shouldn’t be killed because the work they will have or do reaches from necessary to absolutely needed to be done in this particular case.

I want a solution for this problem but I don’t know how to do that …

My goal is to have a list of Macros that will automatically be excluded so that They could continue and a list of macros which will pause if I press the kill switch button on my Streamdeck.

Also any other macro that gets in the way which could not be listed when the kill switch macro runs should go through this setup and should also be listed …

Since there are possible entries I could have selected wen there isn’t update to the listing should be killed or not killed while the list updates so that this process will take as less load as possible on the Mac.

The lists of macros I want to have formatted in the KM typical „friendly Value“ pattern „UUID__Name“

Any help is appreciated

Greetings from Germany


If you are finding you have to use Cancel All Macros regularly, that is probably something you need to think about resolving. Cancel All Macros is really an emergency thing, it should not be something you use regularly. Rather, ensure your macros that are long running have other ways of being canceled, or operate in a safe way, and use care when creating new macros that contain loops or otherwise can run for long periods of time that they will behave as expected before unleashing them (such as adding a Cancel This Macro to the end of the loop so that only the first iteration runs (or a more complex system that stops after the first handful of iterations) until you are sure it is behaving properly).

Also endeavour to ensure background macros that might be canceled deal with being canceled.

Hello Peter (@peternlewis)

First of all a thank you for diving in.

As you heave read my post about the issue I have with the Enable/Disable Action, you know how my Macros tend to help me do my stuff. This means I have a ton of background activity going on from time to time which I want to have under control…. I use the Cancel All Macros Action absolutely only as it is intended to be used and I develop all macros with absolute confidence based on my knowledge as long I am sure to integrate it fully in to my workflow.

What I want is to create a macro that relies on the alternative form of the Action where you can choose a specific instance, so that I don’t to cancel my background macros until I think it is really necessary to do so because its a lot of time consuming work like restarting to continue on my projects like saving the files, closing the apps, related Finder Folders etc and then reopen them to get the macros back on work I need to have.

For the emergency I really need to cancel all my running macros I tend to build it into based on a long press which should first pause all macros and give me a list and a todo list in reminders what to do to get everything back like I want to and then use this action to cancel all up.

Hope this makes everything more clear to you now.

Greetings from Germany


I would very much like to hear if @peternlewis thinks this approach is sound, but to me it seems like what you are after could be set up like something resembling what I demonstrate bellow:

By placing the first magenta group at the top – of any macro you do not want to be canceled by my attached version of the 'Cancel All Macros'-macro – the executing instance will be added to a list of instances not to be canceled. The magenta group to be placed at the end of he same macro is only to keep this same list clean.

Cancel All Macros Except the Ones Containing the Magenta Groups.kmmacros (3.7 KB)

Macro Image

Heres my variant of the 'Cancel All Macros'-macro — canceling all running instances except those in the list of instances not to be canceled:

Cancel All Macros Except Those in List of Instances Not To Be Canceled.kmmacros (14 KB)

Macro Image

The actual canceling part of the macro is pretty small and simple, but the periodically cleaning up of any old non-running instance IDs, should it be left in the list, is more convoluted (I'd love any pointers if anyone have ideas for a simpler way of doing this, as I am sure there must be). The way I propose to set this all up there should not really be many old instance IDs left behind in the list, but it could happen if any of the macros, 'marked' not to be canceled, for whatever reason fail midway through, or something like that. This periodic clean-up is now set to run once an hour, but it'd probably be just as well setting it to run once a day, or even rarer. While running this macro of course places it's running instance into the list of instances not to be canceled.

1 Like

Hey Alexander

…. :scream:

Wow … that looks amazing… even the idea with that cleanup is brilliant… I now will have to decide on how I can build up on this after I understand everything completely on how you’ve done this in detail.

If you read my other topic I’ve linked to in the reply to Peter you probably can guess why I’m saying this and have an idea of how my macros are set up.

So far I can see it on my iPhone (not at home at the moment) that you are using a maybe new feature that comes with KM 11 ?! - this little indexing thing with a variable ?!

As mentioned in the other post - I am still using KM 10.2 - if I am right with the feature maybe you could post a Version for KM 10, too ?!

And - this is not a must - maybe you could give me some inspiration on pausing macros with a list prompt with the friendly value syntax that shows me them based on a loop when this Cancel Macro is running until I have finished my work going through this list… because that’s also a feature that I want to have built in..

Again - not a must - but a huge amount of help ..

Building the actual end result and implementing this into my MacroLibrary with lots more than 3500 Macros is another story and my part - this will take me days of work …

Many many thanks :pray: for now - and have a great day …

Greetings from Germany


1 Like

Glad to hear that you like the approach, I also do, and it was a fun macro to build!

I believe you are right in that the setting of the variable array is a KM11 feature. But the same should be easily doable by other means also. (I believe searching variable listOfInstnsesNotToBeCanceled for %Variable%local_sub_fromListOfInstncesNotToBeCanceled%, replacing with ‘nothing’ to source could be part of a possible solution here, and could even be a simplification). I am also away from my computer now, but will try to find time to make a KM10-safe version tomorrow!

I do not, right away here, understand this part of the request, but I will try reading it closer tomorrow, and would love to try to help you find a solution!

Edit: Corrected me referring to the wrong search term when suggesting how the clean-up could be done KM10-safe. Making this alteration now, and will upload soon

Here's a version that should be KM10-safe, and indeed doing the deleting of each non-running instance ID using Search and Replace also turned out to be a simplification, in terms of number of actions at the very least. All though I must admit that the setting (deleting) of each array entry to me was the more satisfying solution, haha. Am I the only one having it like that; sometimes choosing one solution over another, just on the basis of it being more enjoyable?

Cancel All Macros Except Those in List of Instances Not To Be Canceled v1.1 (should be KM10 compatible).kmmacros (13 KB)
(built in v11.0.2, but I believe it is now cleared of any KM11-exclusive elements)

Macro Image

The same 'Cancel All Macros Except the Ones Containing the Magenta Groups'-elements, uploaded in post #4, still applies.

1 Like

Hey Alexander :wave:

Many many thanks putting so much time and effort into helping me with this project - I really appreciate this …

Again - a very nice Macro

Have a nice Sunday

Greetings from Germany


1 Like