Keystroke: Option Key Only

Is there a way to have Keyboard Maestro type a keystroke of Option. I don’t want Option-[another key], simply the Option key. I would even be content if I could have Keyboard Maestro type text and have it use the equivalent code of the Option key, which is 58.

I have tried using Keyboard Maestro to execute Applescript in two different ways:

tell application "System Events"
   key down option
   key up option
end tell


tell application "System Events"
   key code 58 -- Option key
end tell

Though both these AppleScripts do what they say, they are ignored as a user interface key press. I need to find a way to have it look like I am pressing the Option key. I am not looking to make the option key a trigger.

Keyboard Maestro cannot press (or press and hold) just a modifier key.

In all likelihood, the target application is checking the system modifier flag state, which would not necessarily be set by simulating a modifier keypress anyway.

Sorry I don’t have a better answer for you.

Thanks Peter.

In that case I am going to try to skin the cat in a different way. I can make a change to a plist file to get the same result I want but I am learning more than I wish I had to about how Mavericks uses a cached version of plist files when it boots up. I am trying to figure out how to use what I believe needs to be done, CFPreferencesAppSynchronize, possibly with python, which I have never used before.

I use Keyboard Maestro execute to modify the file to one of the two entries below.defaults write mouseDriver 0defaults write mouseDriver 1After writing the plist file it is not active because I believe it has to be synced with the cached version of prefs.

I am sure it is simple if you know what you are doing. I throw this out incase you or anyone else reading the post knows how to sync the plist with the cached version used by Mavericks.

. . . Stephen

@Stephen check this out:
Double Tap Control

The problem I always have with this is that when you try to execute with a key command the functions don’t work because you are holding down other modifiers to make this do what you want. You have to either put in a delay or have the AppleScript check if modifiers are held down.

I use StefanK’s checkModifierKeys

then add this code at the start of my AppleScript


   set modifierkeysPressed to true

   repeat while modifierkeysPressed
      set modifierkeysPressed to (do shell script "/Library/Scripts/checkModifierKeys") is not "0"
      delay 0.2
   end repeat
on error
   display dialog "You do not have 'checkModifierKeys' installed. "
end try

tell application "System Events"
   key code 58 -- Option Key
   -- key down option
   -- key up option
end tell

The key down and key up have cause problems many times for me where it a modifier can get stuck on because up doesn’t register. Those are good of course if you need to insert a delay or functions in between.

I use the above AppleScript for Sibelius with the control modifier and then jump to menu shortcuts because the control key pressed and released will show a bunch of other alpha keys I can press to run other functions. That way I can use any key command in Keyboard Maestro and have it run the right functions after I let go of all modifiers.

I am sure you have long solved your issue but might be helpful to someone else. Ideally I would rather have Keyboard Maestro just press and release a modifier while I am still holding that modifier to execute another command.

In Keyboard Maestro 7.x there is now a Type Modifiers action that can press or press and hold (until the macro completes) a modifier.

It is likely that the interfaces you describe will ignore Keyboard Maestro holding the key down as well though.

1 Like

You can use the Pause Until action with the Modifiers condition at the start of your macro to pause the macro until you release the modifiers associated with the hot key trigger so that they do not interfere with the behaviour of the applications you are controlling.


Thanks for offering your solution. I haven't been able to keep the modifier pressed after being triggered by the hotkey with the instructions your provide. Could you pleas demonstrate what you meant by posting a screenshot of the editor? I might have misunderstood.

No key will ever be kept held down after the macro stops. So to keep a key held down, the macro must continue to run, perhaps with the Pause action at the end.

Sorry for replying to this ancient thread, it seems to be the only thread about "Type Modifiers"
Looking at the examples above i was still not able to make this work in the latest version of Keyboard Maestro 9.

What am i attempting todo:
Having a working "Shift" key on my Streamdeck.
(For Shift clicking links in browsers for example)

I have been attempting all types of things with this "type modifier" to try and get that working, but nothing works. It is Correctly recognizing me pressing the key on the Streamdeck because the "Notifications" are correctly triggering at start and after 5 sec.

Any suggestions?

Setup below:

on macOs version 10.15.3 Catalina

You cannot do this with Keyboard Maestro. The held modifiers apply only to virtual events. Causing a real event (like typing a character) will have the real modifiers associated with it.

1 Like

Ah apologies for the confusion , and thank you for clearing it up!

You can now! Please see attached image.

I needed to do something like this for photoshop. Here is the case.

I used "Clone Stamp" a lot, it's a brush that moves a range of pixels from one chose place to where you want it.

To use the Tool you must Press S, this choose the area with "Option Key + Left Mouse Click" then you can go about your business.

1 Like