Enable Voice Control with AppleScript – Error in Monterey

Hi,

Enable voice control – this works fine in Catalina but shows an error in Monterey.

Still works but... Voice control bility Nice

Error = Select Menu Item failed to find target menu bar for View➤Voice Control➤Accessibility. Macro “MAC VOICE ENABLE” cancelled (while executing Select “Accessibility” in the Menu “View” in System Preferences).

AppleScript macro step...

tell application "System Preferences"
   activate
   reveal anchor "Dictation" of pane id "com.apple.preference.universalaccess"
   -- activate
   
   delay 0.5
   tell application "System Events"
      tell process "System Preferences"
         click checkbox "Enable Voice Control" of group 1 of window "Accessibility"
      end tell
   end tell
   delay 1
   -- delay just to see it for now
   tell application "System Preferences" to quit
end tell

There's some SO threads:

and

Thanks so much - sorry for the delay - I just saw these.

1 Like

I tore my hair out for a while, but here is working code for users wishing to toggle voice control in Ventura.
Source: python - Enabling voice control in AppleScript Ventura - Stack Overflow

do shell script "open -b com.apple.systempreferences " & ¬
	"/System/Library/PreferencePanes/UniversalAccessPref.prefPane"

tell application "System Events"
	tell its application process "System Settings"
		repeat until UI element 4 of group 1 of scroll area 1 of group 1 of ¬
			group 2 of splitter group 1 of group 1 of window "Accessibility" exists
			delay 0.1
		end repeat
		click UI element 1 of group 3 of scroll area 1 of group 1 of group 2 ¬
			of splitter group 1 of group 1 of window "Accessibility"
		click checkbox "Voice Control" of group 1 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window "Voice Control"
		
	end tell
end tell
tell application "System Settings" to quit
1 Like

Great - thanks so much.

Thank you Apple for renaming this and calling it Live Speech. This has broken the script. :sob:

1 Like