Skip to content

Instantly share code, notes, and snippets.

@marcbachmann
Created September 13, 2015 13:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcbachmann/57b4b9094ff0511dfe18 to your computer and use it in GitHub Desktop.
Save marcbachmann/57b4b9094ff0511dfe18 to your computer and use it in GitHub Desktop.
Switch audio output on mac
tell application "System Preferences" to activate
tell application "System Events"
get properties
tell application "System Preferences"
reveal anchor "output" of pane id "com.apple.preference.sound"
end tell
tell process "System Preferences"
set theRows to every row of table 1 of scroll area 1 of ¬
tab group 1 of window "sound"
repeat with aRow in theRows
if (value of text field 1 of aRow as text) ¬
is in "Panasonic-TV, RX-V767" then
set selected of aRow to true
exit repeat
end if
end repeat
end tell
end tell
tell application "System Preferences" to quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment