Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Levi Alberta

macrumors newbie
Original poster
Trying to come up with an AppleScript that will press Function and Enter together...

The script I have so far is:

tell application "Vuze" to activate
tell application "System Events"
tell process "Vuze"
keystroke "u" using {command down}
keystroke "v" using {command down}
key code 65535 using keystroke return
end tell
end tell

I looked up the key code for the function key, and 65535 is what came back. The start of the script is grabbing some data from a text file and copying the contents. It is then pasting the contents into Vuze (which is where the Command V comes from.

The script pastes the data correctly into the window that pops up (when you press Command U). Problem is, when I press Funtion + Return together, it selects "Ok" which is on the window and the problem is solved. When I attempt to get the script to do it it just keeps repeating itself over and over again and not once does it select Ok.

Thoughts?
 

Attachments

  • Screen Shot 2014-02-03 at 12.08.35 PM.png
    Screen Shot 2014-02-03 at 12.08.35 PM.png
    91 KB · Views: 231
From the System Events Dictionary :

key code v : cause the target process to behave as if key codes were entered
key code integer : The key code(s) to be sent. May be a list.
[using command down/control down/option down/shift down] : modifiers with which the key codes are to be entered

The result of pressing Funtion + Return together on my AZERTY Belgian Aluminium Apple keyboard reveals decimal 63 in the Full Key Codes application.
 

Attachments

  • Picture 3.png
    Picture 3.png
    23.3 KB · Views: 218
  • Keyboard-Aluminium.jpg
    Keyboard-Aluminium.jpg
    49.1 KB · Views: 228
Last edited:
I'm reading and re-reading your response. I'm a little confused (I'm by no means an expert at this..).

My initial thoughts is to change the script to this:

tell application "Vuze" to activate
tell application "System Events"
tell process "Vuze"
keystroke "u" using {command down}
keystroke "v" using {command down}
key code v
key code integer {65535, 36}

key code 65535 using keystroke return
end tell
end tell

Is this correct? I just tried it and it fails. I'm guessing I really screwed it up.
 
Yes, that is the same function key that is in your previous post. I have attached a screen shot from the "key codes" app that I downloaded.
 

Attachments

  • Screen Shot 2014-02-03 at 6.50.39 PM.png
    Screen Shot 2014-02-03 at 6.50.39 PM.png
    56 KB · Views: 251
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.