-1

I attend several recurring Zoom meetings every day and would like to control Zoom’s audio output. I need a AppleScript or JavaScript to toggle On / Off Zoom audio without changing it at MacOS [System Level] only in Zoom App.

I use Zoom Output "Select a Speaker" according to the following options:

Audio-On = Build-In Output (Internal Speaker) /

Audio-Off = NDI Audio (not in operation)

To accomplish this I use the following steps:

  1. Select the Zoom Window
  2. Locate Mic botton
  3. Select the options feature [⋀]
  4. Select a Speaker "alternative" to activate/deactivate audio.

Zoom has a [Mute-Mic] but no [Mute-Spkr] button. It would be nice to have this handy, when you need to answer a phone call.

Zoom screen with keystones to change Speaker options

Dirk
  • 11
  • 3
  • **Stack Overflow** is not a code writing service! Also, please do not post the same question on multiple **Stack Exchange** sites (https://superuser.com/questions/1686959/toggle-audio-output-on-off-within-zoom-meetings) What have you tried so far and were is it failing to achieve the results wanted? – user3439894 Nov 11 '21 at 23:59
  • @Stack Overflow, apologies for not knowing in advance that superuser.com was a paid question / answer site. Understanding that, I proceeded to post the question on Stack Overflow, where I assumed to find an answer. I regret that I neglected to understand what you were doing. I expected a simple 1-2 line script that might also help others. – Dirk Nov 12 '21 at 14:47
  • Assumed that my question was similar to the following. https://stackoverflow.com/questions/64803548/how-to-start-zoom-meeting-automatically-from-c-sharp-console-application – Dirk Nov 12 '21 at 14:57

1 Answers1

0
  1. Open your Zoom.app window.
  2. Open Automator
  3. Select Create new Workflow or Create new Action
  4. Press RED button. This will activate Automator recording window of all your following manual actions.
  5. Accomplish manually 4 actions you described in the question.
  6. Close Automator recording window
  7. Drag written by Automator actions down to code area. One by one. This will show you its scripts. Remains copying the useful content from the script generated by the Automator. And cleaning the external quotes and escapes.

For example: I wrote using the Automator my click action on the current webpage.

Here is generated Automator code:

on run {input, parameters}
    -- Mouse Clicked
    delay 7.956482
    set timeoutSeconds to 2.000000
    set uiScript to "click group 1 of list 2 of group 8 of UI Element 1 of scroll area 1 of group 1 of group 1 of tab group 1 of splitter group 1 of window \"javascript - Toggle Audio-Output On/Off within Zoom Meetings (MacOS) - Stack Overflow\" of application process \"Safari\""
    my doWithTimeout( uiScript, timeoutSeconds )
    return input
end run

on doWithTimeout(uiScript, timeoutSeconds)
    set endDate to (current date) + timeoutSeconds
    repeat
        try
            run script "tell application \"System Events\"
" & uiScript & "
end tell"
            exit repeat
        on error errorMessage
            if ((current date) > endDate) then
                error "Can not " & uiScript
            end if
        end try
    end repeat
end doWithTimeout

I take from the script above only this useful content. As you can see I grab only the correct UI action (the value of uiScript variable) :

tell application "System Events" to tell application process "Safari"
    set frontmost to true -- required
    click group 1 of list 2 of group 8 of UI element 1 of scroll area 1 of group 1 of group 1 of tab group 1 of splitter group 1 of window "javascript - Toggle Audio-Output On/Off within Zoom Meetings (MacOS) - Stack Overflow"
end tell
Robert Kniazidis
  • 1,760
  • 1
  • 7
  • 8
  • Robert, Thank you very much for your answer. I used your technique to make the script, but I found a problem that some of the parameters are static and if I run it a few days later, they no longer match. Script variation between different sessions: Yesterday: set uiScript to "click UI Element 12 of window \"Zoom Meeting\" of application process \"zoom.us\"" Today: set uiScript to "click UI Element 3 of window \"Zoom Webinar Panelist(25) Attendee(110)\" of application process \"zoom.us\"" Is there any dynamic alternative I can use? – Dirk Nov 16 '21 at 17:02