Why Would A Macro Keep Running After Cancel All Macros?

I'm building a macro and am running into an issue where it will continue performing its actions even if I use Cancel All Macros or Quit the Keyboard Maestro Engine. The only thing that seems to be able to stop it is quitting the application it's focused on. Can anyone look at the macro and tell me what I'm doing wrong?

For some background, it's a macro that will archive hundreds of settings within Logic Pro. I'm working on adding more checks and chances to abort, as a delay here and there can cause it to get out of sync and have unexpected results. It's difficult to troubleshoot when I can't cancel it.

Archive Channel Strips.kmmacros (25.4 KB)

It wont. If the engine is quit, no actions can be run. If Cancel All Macros is executed, then all the actions will be canceled, though new macros might start immediately.

The consequences of executing a macro might continue on. For example, the system has a keystroke queue, so keys can be queued in there and they will continue to be processed. And scripts that are executed asynchronously can leave the scripts running in the background.

Anything else you are seeing is almost certainly confusion about something else going on.

Thanks Peter, that’s definitely what it is. I didn’t realize keystrokes worked in a queue. I’ll see how to redesign my macro to limit these consequences.

1 Like

Yes, this is a system technical issue that it is important to understand. User input events (key presses, clicks, mouse movement, etc) go in to a system queue. Then they are plucked out by the system and handed off to the current application one at a time. So if you are simulating a large amount of events, you need to ensure that you periodically wait for the system to catch up.

1 Like