Jump to content
EqualsNine

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"
                        else
                            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.

 

Thanks!

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...