Last active
February 16, 2021 08:06
-
-
Save kxalex/396981adbe978db6da9937d308c2349c to your computer and use it in GitHub Desktop.
AppleScript to choose input device (i.e. microphone)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install SwitchAudioSource tool to make this script work | |
# brew install switchaudio-osx | |
# I assigned fn^⌥⌘M hotkey (using BetterTouchTool) to have quick access to input devices | |
set theInputDevices to paragraphs of (do shell script "/usr/local/bin/switchaudiosource -t input -a | sed -E 's/(.*)\\ \\(input\\)/\\1/'") | |
set theCurrentDevice to do shell script "/usr/local/bin/switchaudiosource -t input -c" | |
set theInput to choose from list theInputDevices with prompt "Select Input Device:" default items {theCurrentDevice} | |
if theInput = false then return | |
do shell script "/usr/local/bin/switchaudiosource -t input -s '" & theInput & "'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment