Simulate keystroke not respecting option key

I'm working on a KM macro that right-clicks in the app (Digital Performer) to reveal a popup contextual menu, then hits keystrokes and arrow keys to navigate to the desired choice, then, to confirm the choice, I need KM to press option-return.

When I test it, KM sends a plain return (not opt-return). If I use my keyboard manually to press opt-return, that works properly.

Any thoughts on why KM isn't respecting the modifier when doing a simulated keystroke?

This is on v9.0.5.

(Another viable option would be to opt-click on the desired choice, but I don't know how to accurately tell KM to move the mouse to that exact location. The app draws the contextual menu in a slightly different way depending on its position on-screen, so I'm hesitant about using Found Image.)

I'm curious why the app does not use the standard "Return" key to trigger the context menu selection. At least that's what all the apps I run use.

Aside from that, in some instances I use a "Found Image" to move the cursor to the correct location. This seems to work fine. Use "Shift+Cmd+4", select area and hold Control before letting up mouse to save to Clipboard.

I also use "Enter Text by Typing" to select the desired context menu item, but this would not resolve the "Opt+Return" issue.

The app does accept a standard return key, but does a different behavior if you press opt-return, and I need the different, opt-return behavior.

I could try Found Image but it's more problematic because of the way the program varies the way it draws the menu, depending on zoom, skin, etc...

Are you simulating the Option-Return with a Keystroke?


It may be that the app is not properly processing the events, and instead is testing the state of the option key directly when it gets the return.

Thanks Peter. Yes, I was simulating option-return with the exact keystroke you posted above.

That theory sounds likely. I'll contact the developer, but I'd be willing to bet it'd be a major change on their part since they use modifiers for a lot of things, so it'd require a lot of testing for a huge app.

Any suggested workarounds from the KM side? Is there any way to emulate the state of the option key?

You could try:


Or maybe try simulating the keystroke with AppleScript (should product the same result, but who knows).

I really have no idea. Other than that, the only possibility would be if there is some alternative way of making the action happen that Keyboard Maestro could simulate.

That almost worked, then after considerable testing, I found the solution. I had to use press and hold modifier, then type return, then pause for 0.4 seconds (anything shorter would fail), then release the modifier. This was my solution:

Screen Shot 2020-05-31 at 2.40.42 PM

Thanks so much for the help in finally figuring this out!

1 Like