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 & 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
Best Answer
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.
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 :-) )