Problems with "Pause until..." Action - trouble detecting key press/mouse click

Hello Forum! I have some lengthy macros that I have used for > 5 years that utilize the "Pause Until" Action in several places so that I can manually add some text in-between the fully automated parts. The two conditions I use to "Un-pause" the macros are either a key press or a mouse click.

My issue is that over the last 6 months or so, I frequently have to press the key or click the mouse several times for KM to register the keypress or click before the macro resumes. These macros have not been altered recently and were working fine for years before the recent trouble.

I wanted to mention it on the forum to see if this was a known issue or if it unique to me.

For me it started on my M1 MacBook Pro running Ventura and the last version of KM version 10 over the summer of 2023. I was hoping that it would correct itself as I upgraded to an M3 MacBook Pro (Sonoma 14.1.2 ) and updated to KM Version 11.0.2, but still no change.

Any thoughts or suggestions?

Thanks!

Pause Until detects state, not events.

You are wanting to detect the event of a key press or a mouse click, not detect the state of whether the key is down or the button is pressed.

By default, in recent versions of Keyboard Maestro uses a Reduced CPU option, which means the check is happening less frequently which is why you are seeing the issue more often. You could turn off that option, but really that is just making the issue less prevalent.

The problem is that the Pause Until only checks the state periodically, and you are holding the key/button down momentarily, and unless you hold it down long enough there is no guarantee that the Pause Until will check at the right time.

If you want to detect an event (key press / button press), use a trigger (USB Device Key trigger). Use a macro like this:

  • Macro “Detect Key Pressed” (Disabled)
  • Trigger on USB Device Key (key pressed or mouse button as desired)
  • Set variable "Key Pressed" to "1"

Then instead of your Pause Until, use:

  • Set variable “Key Pressed” to “0”
  • Enable Macro “Detect Key Pressed”
  • Pause Until variable “Key Pressed” is not “0”
  • Disable Macro “Detect Key Pressed”

The macro will detect your press no matter how fast it is, and the variable will always be set and the Pause Until will work no matter how slow it checks for the event.

7 Likes

Thank you so much! I implemented your suggestion and my macros are working properly again. I am interested however in how to turn off the Reduced CPU mode. How is that done? Thanks again!

1 Like

It's in the Gear menu of the Pause Until action.

Thank you!

Thank you for the solution. I am going to try unchecking the "reduce CPU" flag on the pause before going with the variable-based approach to see if this works for me. If not, on to "Detect Key Pressed". I appreciate your help.

The issue is, it'll work for you some times. Maybe even most times. But it will never be guaranteed to catch the key unless you ensure you hold the key down long enough.