Search code examples
applescriptvoice-recognitionkeystrokekeystrokes

Keystroke Fn (function) key in Applescript


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!


Solution

  • 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.