AppleScript Setting Select Drop Down I am trying to enable dictation with applescript and so far have the following that works.
But, how do I set the drop down for the shortcut key using AppleScript?



Below is the AppleScript code:

tell application "System Preferences"
reveal pane id "com.apple.preference.speech"

tell application "System Events"
    tell process "System Preferences"
        tell window "Dictation &amp; Speech"
            tell tab group 1
                click radio button "Dictation"
                tell radio group 1
                    if value of radio button "On" is 0 then
                        click radio button "On"

                    end if
                end tell
            end tell
            if sheet 1 exists then
                tell sheet 1
                    click button "Enable Dictation"
                    repeat while sheet 1 exists
                    end repeat
                end tell
            end if
        end tell
    end tell
end tell
quit -- optional
end tell
Using the shell Defaults command in an Applescript Do shell script seems to work ok for me. This will save on GUI scripting problems.

The script first reads the preference file. Then sets it to the opposite of its Bool.

set dictionToggle to (do shell script " defaults read ~/Library/Preferences/com.apple.assistant.support \"Dictation Enabled\" ") as integer

do shell script "defaults write  ~/Library/Preferences/com.apple.assistant.support \"Dictation Enabled\" -bool " &amp; (not (dictionToggle as boolean)) as Unicode text




I always backup any preference files using the contextual menu compress "…." 
to make a zipped copy of it.



The file com.apple.assistant.support.plist that is changed is found in your preferences folder

/Users/UserName/Library/Preferences/com.apple.assistant.support.plist



If you have to use GUI scripting especially if you want to change the short cut keys. ( and since I cannot be Ars… to figure out which one of the symbolic  hotkey settings in the com.apple.symbolichotkeys.plist is the right one)

Then this should work. (as it does on my Mac at least :-)  )

  set off to 1
set fnTwice to 3
set rightCommandTwice to 4
set leftCommandTwice to 5
set eitherCommandTwice to 6


tell application "System Preferences"
    activate
    set current pane to pane "com.apple.preference.speech"
    reveal (first anchor of current pane whose name is "Dictation") 
end tell
tell application "System Events"

    tell application process "System Preferences"
        set theGroup to tab group 1 of window "Dictation &amp; Speech"
        click radio button "On" of radio group 1 of theGroup

        try
            click button "Enable Dictation" of sheet 1 of window "Dictation &amp; Speech"
        end try
        set thePopUp to pop up button 2 of theGroup
        click thePopUp
        click menu item fnTwice of menu 1 of thePopUp
    end tell
end tell
tell application "System Preferences"
    --quit
end tell