keystroke Function keys?

can you send keystrokes of the F keys?


No, you cannot keystroke function keys through applescript as is. There might be a workaround though. What function are you trying to script?



the F key shortcut was to be used from Quark as a workaround for something that cannot be scripted (updating modified images)

i guess this is a loose loose situation


I pretty sure you can send F-Key strokes using applescript!

tell application "System Events" tell application "VNCThing" to activate key code 96 -- Send F5 to VNCThing so IE refreshes the page end tell
As pointed out by Bruce Phillips in another thread, you can determine key codes with Full Key Codes.

Oh thanks a lot, Brontojoris

That works perfectly. I was completely unaware of key codes

Of note:
F1 = 92
F2 = 93
F4 = 94

F15 = 106

Is there a list of other key codes around? specifically the TAB key?

Tab is ASCII 9
Keycode HEX 30
Keycode DEC 48

The best list of mac key codes I’ve found is here:

Silvermeteors is right, the list is not quite in order. I saved the link to my drive for quick reference.

F1 122
F2 120
F3 99
F4 118
F5 96
F6 97
F7 98
F8 100
F9 101
F10 109
F11 103
F12 111

Model: Dual 2.3GHz G5
AppleScript: 2.1.1/Script Debugger 4
Browser: Firefox
Operating System: Mac OS X (10.4)