Skip to content

Instantly share code, notes, and snippets.

@henrik
Created April 28, 2016 15:18
Show Gist options
  • Save henrik/172334da0d34d55e4cc3a9086bcd5183 to your computer and use it in GitHub Desktop.
Save henrik/172334da0d34d55e4cc3a9086bcd5183 to your computer and use it in GitHub Desktop.
AppleScript to change Screenhero audio input/output device.
-- AppleScript to change Screenhero audio input/output device.
-- By Henrik Nyh for Auctionet.com 2016-04-28 under the MIT license.
--
-- Usage in a terminal, assuming this file is screenhero_io.scpt:
--
-- osascript screenhero_io.scpt "My desired input" "My desired output"
on run argv
set desiredInputDevice to item 1 of argv
set desiredOutputDevice to item 2 of argv
tell application "Screenhero"
activate
end tell
tell application "System Events"
tell process "Screenhero"
-- Open prefs
click menu item "Preferences…" of menu "Screenhero" of menu bar item "Screenhero" of menu bar 1
tell window 1
-- Go to audio
click button "Audio" of toolbar 1
-- Pick input
tell pop up button 1
click
pick menu item desiredInputDevice of menu 1
end tell
-- Pick output
tell pop up button 2
click
pick menu item desiredOutputDevice of menu 1
end tell
-- Intentionally leaving the window open so you see that it picked the right thing.
end tell
end tell
end tell
return "Done."
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment