Skip to content

Instantly share code, notes, and snippets.

@seltzered
Last active October 21, 2022 18:17
Show Gist options
  • Save seltzered/3b627104c8a7a39b863c to your computer and use it in GitHub Desktop.
Save seltzered/3b627104c8a7a39b863c to your computer and use it in GitHub Desktop.
Mac OSX Set Sound Output to Internal Speakers.applescript
-- Script to set sound output - "Internal Speakers" hardcoded as I just keep multiple scripts for each output source (e.g. Internal Speakers, Airplay, bluetooth ) and use it with a quicklaunch app such as quicksilver.
-- Based off of Pierre L's answer in https://discussions.apple.com/thread/4629093?tstart=0 , which includes a selection dialog
set asrc to "Internal Speakers"
tell application "System Preferences"
reveal anchor "output" of pane id "com.apple.preference.sound"
activate
tell application "System Events"
tell process "System Preferences"
select (row 1 of table 1 of scroll area 1 of tab group 1 of window "Sound" whose value of text field 1 is asrc)
end tell
end tell
quit
end tell
@andreasf
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment