0

On a Zoom call, I'd like to use AppleScript to determine the currently active Microphone and Speaker.

I can select a Mic option using https://github.com/raycast/script-commands/blob/master/commands/communication/zoom/toggle-mic.applescript but am unable to figure out how to read the values.

Zoom settings

hasan
  • 101

1 Answers1

0

you can use GUI scripting for this, e.g. this gets you the current speakers:

    tell application "System Preferences"
        reveal pane id "com.apple.preference.sound"
    end tell
tell application "System Events"
    tell application process "System Preferences"
        tell tab group 1 of window "Sound"
            click radio button "Output"
            tell table 1 of scroll area 1
        set selected_row to (first UI element whose selected is true)
        set currentOutput to value of text field 1 of selected_row as text
        display dialog currentOutput
            end tell
        end tell
    end tell
 end tell

 if application "System Preferences" is running then
    tell application "System Preferences" to quit
 end if`

GUI script elements might be located differently on different MacOS releases.

  • Thanks - but this gets the current system output. Zoom has a unique capability where you can set the speakers distinct from the System output. – hasan Aug 05 '22 at 20:01
  • Which doesn’t change the system settings when on call? I have to try this later… maybe this helps in finding which - if any - AppleScript commands Zoom offers. – slartibartfast Aug 05 '22 at 20:06
  • Yes - that's why it's not as straight forward. Thanks for the Open Dictionary resource - didn't know that existed! Zoom doesn't have any official AppleScript commands. I think I'll need to investigate more of the GUI scripting. – hasan Aug 05 '22 at 20:36
  • @slartibartfast You really ought to test code before sharing it. That said, your code is nice. I would +1 had it been relevant to the OP's question. – CJK Aug 08 '22 at 05:16