mellow-yellow
mellow-yellow

Reputation: 1820

applescript keystroke: right command and right control keys?

In Applescript, how can I send the keystroke for the right control key on the keyboard? How about right command key? Ultimately, I want to right-click in WINE (winehq's FAQ explains that's not currently possible with ctrl+click). But, it works great via KeyRemap4MacBook, although I need to send the right key.

tell application "System Events" to key code ???????

Upvotes: 0

Views: 957

Answers (2)

macscripter
macscripter

Reputation: 47

For the right control it is:

tell application "system events"  
key code 62   
end tell

Upvotes: 1

Lri
Lri

Reputation: 27633

See Events.h or https://github.com/tekezo/KeyRemap4MacBook/blob/master/src/bridge/generator/keycode/data/KeyCode.data.

The right command is supposed to be 0x36 or 54, but this didn't work for me:

delay 1
tell application "System Events" to key code 54

I also tried adding __KeyToKey__ KeyCode::COMMAND_R, KeyCode::Q to private.xml. tell app "System Events" to key code 0 inserts a even if you change a to some other key with KeyRemap4MacBook.

Upvotes: 0

Related Questions