Skip to content

Instantly share code, notes, and snippets.

@tyhawkins
Last active May 27, 2022 20:51
Show Gist options
  • Save tyhawkins/66d6f6ca8b3cb30c268df76d83020a64 to your computer and use it in GitHub Desktop.
Save tyhawkins/66d6f6ca8b3cb30c268df76d83020a64 to your computer and use it in GitHub Desktop.
Get Zoom Mute/Unmute Status
property btnTitle : "Mute audio"
if application "zoom.us" is running then
tell application "System Events"
tell application process "zoom.us"
if exists (menu item btnTitle of menu 1 of menu bar item "Meeting" of menu bar 1) then
set returnValue to "Unmuted"
else
set returnValue to "Muted"
end if
end tell
end tell
else
set returnValue to ""
end if
return returnValue
@liqweed
Copy link

liqweed commented Jan 21, 2021

@torgeir
Copy link

torgeir commented Mar 9, 2021

Thanks! 👏 This is fantastic! 🥇 I did this to show the status on os x using AnyBar or Ubersicht
https://gist.github.com/torgeir/79f75dea46e4d16a3725515aabe74674

@patrickgilsf
Copy link

Hi all, I stumbled upon this thread, as I have a project I'm working on, and looking for the following solution. I have a script I wrote in node, that I'm trying to get to listen for mic mute/unmute events on Zoom's OS app. I'm wondering, is there way to get osascript to poll that mute status of the mic? Not just mute/unmute? Thanks!

@chrmcg
Copy link

chrmcg commented Mar 17, 2022

@patrickgilsf I use the following in SwiftBar, modified a bit from https://www.nickjvturner.com/blog/2021/01/11/zoom-meeting-mute-state

Seems like the idea could work for your use case?

# <bitbar.title>zoomMuteState</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>nickjvturner</bitbar.author>
# <bitbar.author.github>nickjvturner</bitbar.author.github>
# <bitbar.desc>Zoom Mute State</bitbar.desc>
# <bitbar.image>http://www.hosted-somewhere/pluginimage</bitbar.image>
# <bitbar.dependencies>Applescript</bitbar.dependencies>
# <bitbar.abouturl>http://url-to-about.com/</bitbar.abouturl>

# <swiftbar.hideAbout>true</swiftbar.hideAbout>
# <swiftbar.hideRunInTerminal>true</swiftbar.hideRunInTerminal>
# <swiftbar.hideLastUpdated>true</swiftbar.hideLastUpdated>
# <swiftbar.hideDisablePlugin>true</swiftbar.hideDisablePlugin>
# <swiftbar.hideSwiftBar>false</swiftbar.hideSwiftBar>

property btnTitle : "Mute audio"

if application "zoom.us" is running then
	tell application "System Events"
		tell application process "zoom.us"
			if exists (menu bar item "Meeting" of menu bar 1) then
				if exists (menu item btnTitle of menu 1 of menu bar item "Meeting" of menu bar 1) then
					set returnValue to "Audible"
				else
					set returnValue to "Muted"
				end if
			else
				set returnValue to "No Zoom"
			end if
		end tell
	end tell
else
	set returnValue to "No Zoom"
end if

return returnValue & "| size=13
---
zoomMuteState"

@patrickgilsf
Copy link

patrickgilsf commented Mar 18, 2022

Thanks @chrmcg, I actually found what I needed (wanted to poll video start/stop status as well) like this. I'm all set! Menu bar...that was genius.

set zoomStatus to "closed"
set muteStatus to "disabled"
set videoStatus to "stop"
tell application "System Events"
	if exists (window 1 of process "zoom.us") then
		set zoomStatus to "open"
		tell application process "zoom.us"
			if exists (menu bar item "Meeting" of menu bar 1) then
				set zoomStatus to "call"
				if exists (menu item "Mute audio" of menu 1 of menu bar item "Meeting" of menu bar 1) then
					set muteStatus to "unmuted"
				else
					set muteStatus to "muted"
				end if
				if exists (menu item "Start video" of menu 1 of menu bar item "Meeting" of menu bar 1) then
					set videoStatus to "stop"
				else
					set videoStatus to "start"
				end if
			end if
		end tell
	end if
end tell

@IdiotRat
Copy link

can someone give me full script that i can use in greasyfork

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