By Alvin Alexander. Last updated: June 6, 2016
As a quick source code example, this is how I emulate pressing the Fn
key on a Mac OS X keyboard using AppleScript:
tell application "System Events" key code 63 key code 63 end tell
The key code for the Fn
key is 63, so all that code does is emulate pressing that key twice. Doing this triggers the Mac speech-to-text facility, which I use in my Sarah application (like Siri for the Mac).