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