Intercept command then exit back to original app

Hello all,

Maybe there is a simple solution, but I wonder if someone could advise me if this can be done in KM.

I'd like to intercept a CMD-ENTER keystroke, save a custom variable then pass the CMD-ENTER back to the original application so it can continue saving my record.

I thought of capturing a different keystroke (e.g. ALT-CMD-ENTER) then passing the CMD-ENTER but was wondering if there is any other way I can explore which would allow me to re-use the same CMD-ENTER hotkey.

Thank you!


Generally simulating a key which is a hot key leads to unpredictable results, since the simulated key may either trigger the macro or go through to the application. Keyboard Maestro tries to make it the latter, but because the keyboard event queue is an asynchronous queue (ie, the system may take an arbitrary long time to process the simulated key), there is no way to guarantee it.

You can explicitly disable the macro, simulate the key, pause for some length of time, and then re-enable the macro. If you know you won't want to trigger the macro again for several seconds, then you can safely pause for quite a long time which should ensure the system has had a chance to process the key.

Hey Ivan,

Tell us what software you're working with, so we have a better idea of what you're doing and how to help you.


One common approach to this problem is to use the App's menu rather than trying to use the same keystroke that you used to trigger the KM Macro.

See Select or Show a Menu Item action.


  1. Trigger the KM Macro using CMD-ENTER
  2. At the end of the Macro, execute the app function using Select or Show a Menu Item action.

Thank you everyone for your ideas!

Just to give you more details on my original objective and solution, I have a hotkey to create new web link items in an app called Keep It.

The hotkey opens ups an input popup, where I enter a tag value and then CMD-ENTER to save the item.

I wanted to save my tag value before passing on the CMD-ENTER so it can pre-populate before saving the next item.

Unfortunately, the CMD-ENTER was not available on the main app menu, so I thought about using the macro disable/enable method.

It then occurred to me that I could use a different hotkey to trigger the save, before passing on the CMD-ENTER. It seems to work and I just have to remember a different hotkey for saving.

I love it how there are many ways to script things in Keyboard Maestro :grinning: