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.
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.
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.