What is an AppleScript for turning the microphone on?

I am trying to make an AppleScript for turning the microphone on.

I found the AppleScript for putting the microphone to sleep.

set _dictateApp to (name of current application)

tell application _dictateApp

--set microphone to sleep

set «class mIcR» to «constant DpmdDMsl»

end tell


How do I instead turned it on?

MacBook Pro (Retina, 15-inch, Late 2013), OS X El Capitan (10.11.4)

Posted on May 9, 2016 12:16 PM

Reply
1 reply

May 9, 2016 1:04 PM in response to RenegadeCitizen

This will allow you to enable, or disable your input microphone volume. Tested on OS X 10.11.4.


property on_off : {"On", "Off"}

property list_msg : "Turn microphone on or off"


set volume_level to 50 -- percent


try

set status to (choose from liston_offwith title "Microphone Control" with promptlist_msg)

if status is false then error number -128


if status contains "On" then

tell application "System Events" to set volume input volume volume_level

else

tell application "System Events" to set volume input volume 0

end if


on error errmsgnumbererrnbr

my error_handler(errnbr, errmsg)

end try


return


on error_handler(nbr, msg)


return display alert "[ " & nbr & " ] " & msg as critical giving up after 10


end error_handler

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

What is an AppleScript for turning the microphone on?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.