Why is there a delay between actions?

The macro below create a New macro in KM → Press the New Trigger button → Press return to select the first item (Hot key).

My question is why is there a ~1 second delay between the New Trigger button and the return button when there’s no pause action in between them?

Macro

When run:

CleanShot 2025-10-16 at 14.59.24

In my opinion, and not everyone here will agree with me, nobody should ever write a KM macro that manipulates the KM Editor app (like your are doing). Why? Because there are complications that exist for this app that don't exist with any other app. For example, the KM Editor has an auto-save feature that FREQUENTLY gets triggered, and that will inhibit the KM Editor's ability to process incoming keyboard events, because it can't process a keystroke while it is saving macros to disk.

I strongly suspect that it what's happening here. There's nothing you can do to fix it, as far as I know.

I see.

It certainly isn’t ideal. But I think as long as it doesn’t actually mess with individual macros (like deleting it or disabling it or changing the actions within it), then I think it will be fine. And maybe try to avoid using keystroke for macros that mainipulate the KM editor due to the reason you said.

I changed the “Press a button“ to a “click at found Image” action and there are two “keystroke” actions in this new macro. It work at a normal pace without any delay this time?

So it seems like the keystroke didn’t cause a delay here but it’s the fault of the “Press a button“ action…

CleanShot 2025-10-16 at 17.29.51

There has been a long standing issue when showing menus (most commonly this shows up in the status menu, but it happens in this case as well), where when showing the menu via Accessibility it will not immediately accept keystrokes.

In your macro, you can actually see this yourself if you just keep the first two actions:

and then immediately press Return or Down Arrow.

The key stroke is lost (or sometimes delayed).

Don’t ask me why this is the case, this is deep in Apple’s code at that point.

3 Likes

"Select a Menu" isn't "select a menu and continue with the macro" -- it's "select a menu and I'll wait until you tell me the menu has been selected, then I'll continue the macro". Similarly with "Press a button". I believe this is the Accessibility issue Peter is alluding to -- a delay in the reply.

And is why it's quicker to do what you want by keystroke:

But it is, of course, more fragile -- because you aren't waiting for the UI to report back its "readiness" for the next event, any unexpected delay will cause the macro to fail.

2 Likes

:ok_hand: