Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
AppleScript - Switch to hardware mic
-- Force mac book pro 10.13.3 to switch audio input to hardware mic
tell application "System Preferences" to activate
tell application "System Preferences"
reveal anchor "input" of pane id ""
end tell
tell application "System Events" to 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 "Internal Microphone")
end tell
quit application "System Preferences"
Copy link

dotjay commented Jun 24, 2021

Thanks for the script! To get it work in 2021, I had to add a delay 1 before the select command.

Copy link

mustafapc19 commented Jul 23, 2021

Hi. I am new to the apple ecosystem. How should I go about using this script? I am using Script editor and running from there is working but if I switch the sound output source the input source gets changed to my airpods. Any help would had been appreciated

Copy link

lfender6445 commented Jul 23, 2021

@mustafc you need a way too run apple scripts (save it as a .scpt file first)

have a read through

Copy link

mustafapc19 commented Jul 24, 2021

@lfender6445 Thanks for the help. I used FastScript and mapped a keyboard shortcut to the script. Otherwise, it's a big pain since every time I pair the airpods I have to do it again. Thanks for the help tho :)

Copy link

crisdeoliveira commented Oct 2, 2021

i have this error when i run, any ideas?


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