Jump to content

Dictation Toggle Workflow, Keyword doesn't work

Recommended Posts

I don't know AppleScript myself, which is why I came here to ask for help.

The workflow works like this. Keyboard shortcut > run usr/bin/osascript > play sound


this is the code inside the script (I didn't write it myself, found it on apple support forums and slightly modified it):


tell application "System Preferences"
    reveal pane id "com.apple.preference.keyboard"
    tell application "System Events"
        tell process "System Preferences"
            tell window "Keyboard"
                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"
                            click radio button "Off"
                        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


Now the script does successfully toggle dictation, but whenever I turn dictation back on using the workflow, the spoken keyword phrase (which is found under system preferences > accessibility > dictation > [  ] enable the dictation keyword phrase) is disabled, even though the UI shows that it is enabled. I have to turn it off and on again to get it to work. 


Could one of you tell me how I'd have to edit the script to make it so that dictation is turned back on with the keyword phrase still active?

My guess is that if "click radio button "Off" is performed, the script should also go into "Accessibility" and switch "enable the dictation keyword phrase" off and on again. 


I'd really appreciate the help & think it wouldn't take very long to fix for someone who knows AppleScript.



Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...