1

I'm trying to create an app to toggle voice control on and off, as for some reason Catalina removed the link between dictation and voice control thus ridding itself of the ability to use a keyboard shortcut for voice commands. I'm trying to ad that back by creating an app. Am ridiculously disabled (think one step below paralysed) and for my setup this functionality had become very useful.

Here is what I have so far, but unfortunately its not working:

tell application "System Preferences"
    reveal pane id "com.apple.preference.universalaccess"
    delay 1
    tell application "System Events"
        tell window 1 of application process "System Preferences"
            select table 1 of scroll area 1
            delay 0.1
            select row 12 of table 1 of scroll area 1
            delay 0.1
            click checkbox "Enable Voice Control"
        end tell
    end tell
    quit
end tell

It highlights the correct row in the accessibility options but doesn't quite get as far as clicking the checkbox. Results in this error:

The action “Run AppleScript” encountered an error: “System Events got an error: Can’t get checkbox "Enable Voice Control" of window 1 of application process "System Preferences".”

System Events got an error: Can’t get checkbox "Enable Voice Control" of window 1 of application process "System Preferences".

Could someone please offer some direction on where I'm going wrong?

Thank-you!

1 Answer 1

1

Seems like this sorted it:

tell application "System Preferences"
    reveal pane id "com.apple.preference.universalaccess"
    delay 1

    tell application "System Events"
        tell window 1 of application process "System Preferences"
            select row 12 of table 1 of scroll area 1
            delay 0.1
            click checkbox "Enable Voice Control" of group 1
        end tell
    end tell
    quit
end tell

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .