I'm trying to retrieve a list of available AirPlay output audio devices, I don't have a preference on which language to use.
Before Ventura I used the following Apple Script:
set devices to {}
tell application "System Preferences"
reveal pane id "com.apple.preference.sound"
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"
tell table 1 of scroll area 1
set selected_row to (first UI element whose selected is true)
set currentOutput to value of text field 1 of selected_row as text
repeat with r in rows
try
set deviceName to value of text field 1 of r as text
set deviceType to value of text field 2 of r as text
set end of devices to { deviceName, deviceType }
end try
end repeat
end tell
end tell
end tell
end tell
if application "System Preferences" is running then
tell application "System Preferences" to quit
end if
return [ devices, "currentOutput", currentOutput ]
But since the Ventura update this broken and it seems like there's no way to adapt it to work with Apple Script anymore.
Does anyone know how to update it to work with Ventura or could point me to the documentation of either Swift or ObjC to retrieve this list?