Accessibility Sonoma System Settings

Hello!

Recently upgraded from Big Sur to Sonoma out of necessity for no longer supported work apps. The system settings has royally screwed up my accssibility scripts. Only have the use of one hand and am ridiculously disabled, thes escripts help me a tonne and would be a shame to use. Was wondering if I could get some help getting them working again?

Toggle voice control on and off

set outputA to 1 --change this to the actual 'line number' of your first desired output
set outputB to 2 --change this to the actual 'line number' of your second desired output

tell application "System Preferences"
	activate
	set current pane to pane "com.apple.preference.universalaccess"
	try
		set miniaturized of windows to false -- most apps
	end try
end tell

delay 0.5

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

Toggle sound device between two devices

set outputA to 1 --change this to the actual 'line number' of your first desired output
set outputB to 2 --change this to the actual 'line number' of your second desired output

tell application "System Settings"
	activate
	set current pane to pane "com.apple.preference.sound"
	set miniaturized of windows to false -- most apps
	end try
end tell


tell application "System Events"
	tell application process "System Preferences"
		repeat until exists tab group 1 of window "Sound"
		end repeat
		tell tab group 1 of window "Sound"
			click radio button "Output"
			if (selected of row outputA of table 1 of scroll area 1) then
				set selected of row outputB of table 1 of scroll area 1 to true
			else
				set selected of row outputA of table 1 of scroll area 1 to true
			end if
		end tell
	end tell
end tell

Any help would be appreciated, thank you

This will toggle VC in Sequoia:

activate application “System Settings”
tell application “System Events”
tell process “System Settings”
click checkbox “Voice Control” of group 1 of scroll area 1 of group 1 of list 2 of splitter group 1 of list 1 of window “Voice Control”
end tell
end tell

This will change your output setting.

Sound_Output_Switch(2)

on Sound_Output_Switch(theDesiredRow)
	do shell script "open x-apple.systempreferences:com.apple.Sound-Settings.extension"
	tell application "System Events"
		tell application process "System Settings"
			tell window 1
				--Confirm the panel is open and populated.
				repeat until group 2 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 exists
					delay 0
				end repeat
				--press Output radio button
				perform action "AXPress" of radio button 1 of UI element 1 of group 2 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1
				set selected of row theDesiredRow of UI element 1 of scroll area 1 of group 2 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 to true
			end tell
		end tell
	end tell
end Sound_Output_Switch