Macros Partially Repeat and Overlap Themselves

I suddenly had a crazy phenomenon. I start a macro. It gets partway through,and then the macro restarts from the beginning with those early steps overlapping the already running steps. It's a confused mess, and I have to quit the Engine to stop it. So far, I have found this with three macros. Completely quitting Keystroke Maestro didn't help. Shutting down didn't help. Reinstalling my current version of KM, 8.4.2, didn't help.

I have been using these macros for more than a year without problems. I have not made significant changes to my OS (HIgh Sierra) in more than a year. I recently installed, briefly tested, and completely removed three e-mail client applications. I doubt that would mess up KM. My hardware hasn't changed.

Any ideas? Is there something in the Keyboard Maestro Application Support folder that I should trash or alter?

You can Long click on Used button to display the recent run macros to find out what macros are triggering them.

Hey Greg,

What kind of trigger are you using for the macro?

-Chris

It sounds to me like something is triggering the macro again, while it's running. If you launch it based on a hotkey, perhaps the key is acting up and sending the "press" more than once?

If the macro is indeed getting launched again, you can make sure it doesn't run again if it's still running by placing a "Semaphore Lock" action at the start of your macro:

image

Then click the "gear" icon and select "Set Action Timeout...":

image

...and change the values to this:

image

Now, if the macro is running and it tries to run again, it will abort right away.

NOTE:

If the macro is running again because you are calling it using the "Execute a Macro" action, then this may or may not abort the second macro, depending on other factors.

1 Like

I found the cause of the problem. One of the triggers in the macro is the activation of an application. Later in the macro, there is a command to hide the application. Near the end of the macro is a command to show the application. For some reason, showing the application is considered to be activating the application. That triggered the infinite repeats.

Hiding or showing an active application should not change its status: it should be active throughout. I'm not sure why my macro worked in the past. I did remove some Pause steps, but that shouldn't have mattered.

Hi @GregT - well @DanThomas 's comment about something else triggering the macro was spot on, so kudos to Dan!

If you'd posted your macro it would have been clear immediately what the issue was. Even now, suggesting a solution without seeing your macro is just guessing.

There has been considerable discussion in the KM forum about the various application states that can be used to trigger a macro. Here they are:

KM 0 2021-08-03_10-03-11

Despite that, it would seem reasonable to me that when you hide an application it should be classed as "inactive" even though it is still "running"; conversely, when you unhide the app it then becomes "active" again.

I released a KM utility recently and the user guide I wrote to support it had a chapter entitled "The Infinite Trigger". I bet you can guess what that was about.

As we all learn about KM - Pause actions can make all the difference between a macro that works and one that doesn't. Again there have been many posts in the KM forum demonstrating this.

One thing we can all take from this is that sometimes the problems we ask KM to solve require a fair bit of tweaking. :smiley:

After all that - has your problem now been solved?

1 Like

Hiding an application definitely deactivates it. So unless you are talking about hiding and showing an application that is not currently at the front, hiding it will definitely deactivate the application, although I wouldn't think showing it will activate it - it would end up being in the background behind whatever application activated when it was hidden.

1 Like