Launch Dictation With Applescript

applescriptautomatorterminalvoice-dictation

I would have thought this would be easy to find, but thus far it has not been for me.

Is there a way to launch dictation (fn, fn) with applescript or from the terminal?

Best Answer

You can just simulate pressing fn twice:

delay 0.3 -- time to release modifier keys if for example the script is run with command-R
tell application "System Events"
    key code 63
    key code 63
end tell

Or from a terminal:

osascript -e 'tell app "System Events" to key code {63,63}'

The osascript command worked for me in Terminal but not in iTerm 2. The Start Dictation menu item also just plays the lower pitch sound without showing the popover in iTerm 2 though.