I am trying to key code a function key - F2. Looking around the web and on these forums indicates that I should be able to do it with the following applescript, but it does not seem to have any effect. I have the Apple Bluetooth keyboard if the matters. Any ideas?
tell application "System Events"
key code 120
end tell
I am not 100% familiar with key codes and if they need key strokes or not.
But are you trying to use F2 with in a program? As in F2 does something within the app.
Because Appleās shortcuts seem to override any functionality with the keys. Example if I want to take a screen shot in a Steam game (F12) it just puts up the volume and nothing else.
Just my thoughts there for you just incase sorry if its not any help.
There were so many references on the web saying that the F2 key code is 120, when it in fact appears to be 144. These key codes are surprisingly hard to track down.