Jump to content

Pajerow

Member
  • Posts

    4
  • Joined

  • Last visited

Posts posted by Pajerow

  1. Here's the script I use on my Ventura.
    please refer.

    if (system attribute "sys1") is not 13 then return
    
    open location "x-apple.systempreferences:com.apple.Sound-Settings.extension"
    delay 2
    
    tell application "System Settings"
    	tell application "System Events" to tell application process "System Settings"
    		tell window "Sound" to tell group 1's splitter group 1's group 2's group 1's scroll area 1's group 2
    			click tab group 1's radio button 1 --Output tab
    			tell scroll area 1's table 1
    				set RowsList to every row
    				set devList to {}
    				repeat with i in RowsList
    					set devName to i's UI element 1's group 1's static text's name
    					if i's selected then set defaultName to devName
    					set end of devList to devName
    				end repeat
    			end tell
    		end tell
    	end tell
    end tell
    
    tell application "Finder"
    	activate
    	set devSel to (choose from list devList default items defaultName with prompt "Select Device...") as string
    end tell
    
    tell application "System Settings"
    	tell application "System Events" to tell application process "System Settings"
    		tell window "Sound" to tell group 1's splitter group 1's group 2's group 1's scroll area 1's group 2
    			click tab group 1's radio button 1 --Output tab
    			tell scroll area 1's table 1
    				set RowsList to every row
    				set devList to {}
    				repeat with i in RowsList
    					set devName to i's UI element 1's group 1's static text's name
    					if devName contains devSel then
    						set i's selected to true
    						delay 1
    						exit repeat
    					end if
    				end repeat
    			end tell
    		end tell
    	end tell
    	quit
    end tell
    
    

     

×
×
  • Create New...