Skip to content

Instantly share code, notes, and snippets.

Created December 26, 2012 02:20
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 anonymous/4377337 to your computer and use it in GitHub Desktop.
Save anonymous/4377337 to your computer and use it in GitHub Desktop.
Applescript to switch Audio output. Doesn't quite work yet...
tell application "System Preferences" to activate
tell application "System Events"
get properties
set asrc to choose from list {"Internal Speakers", "Living Room", "Girl's Room", "Master Bedroom"} with title "Sound Picker" default items {"Internal Speakers"}
display dialog "src is: " & asrc
tell process "System Preferences"
click menu item "Sound" of menu "View" of menu bar 1
delay 2
set theRows to every row of table 1 of scroll area 1 of ¬
tab group 1 of window "sound"
set theOutputs to {} as list
repeat with aRow in theRows
if (value of text field 1 of aRow as text) ¬
is equal to asrc 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