Dynamically pick a keystroke to type?

Hi All,

In Move window between desktops? - #16 by timvisher I want to trigger a macro with 12 different hotkey triggers and then type a keystroke that corresponds to which of the 12 different triggers was typed.

I found

Both of those options seem like more trouble than they're worth at the moment.

Is there any way currently to dynamically set what key I want to press based on the trigger input that's better than the the Switch structure in my macro or the options outlined in the posts I linked?

In pseudocode I want to

  1. Get the non-modifier key that was pressed
  2. Press that key with the option modifier

Thanks in advance!

Hi, @timvisher. Here's one way...

Keyboard Maestro Actions.kmactions (1.5 KB)

Keyboard Maestro Export


You could replace the second action with a Switch/Case action that would evaluate local_X and then have the required Type a Keystroke actions.

1 Like