3

Is there any way to keystroke the Fn key in apple script? Ideally I would like to be able to "press it" twice in order to launch voice typing.

Thanks in advance!

user2555399
  • 199
  • 1
  • 3
  • 8

2 Answers2

2
delay 0.5 -- time to release modifier keys if the script is run with a keyboard shortcut
tell application "System Events"
    key code 63 -- fn
    key code 63
end tell

See Events.h or my website for the key codes.

Lri
  • 26,768
  • 8
  • 84
  • 82
  • Works perfectly! Do you by chance know how to open a folder through apple script? I think my problem is the spaces in the file path... /Users/username/Library/Speech/Speakable Items – user2555399 Jul 21 '13 at 21:39
0

In an applescript your file path has to be a macpath not a unixpath i.e., separate the directories with a colon (not a forward slash) e.g.,

tell application "Finder"
    open folder "Macintosh HD:Users:username:Library:Speech:Speakable Items"
end tell
p.s.w.g
  • 146,324
  • 30
  • 291
  • 331