-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathzoom-toggle-mute.applescript
52 lines (50 loc) · 1.38 KB
/
zoom-toggle-mute.applescript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
--
-- Created by: Kevin Funderburg
-- Created on: 9/15/20
--
try
if not (application "AnyBar" exists) then
error "AnyBar not installed, either remove line 23 or download AnyBar from 'https://github.com/tonsky/AnyBar'"
end if
if notInMeeting() then error "not in a meeting"
tell application "System Events"
tell process "zoom.us"
tell menu bar 1
tell menu bar item 3
tell menu "Meeting"
if menu item "Mute Audio" exists then
click menu item "Mute Audio"
set diag to "Audio is muted"
set c to "white"
else if menu item "Unmute Audio" exists then
click menu item "Unmute Audio"
set c to "red"
set diag to "Audio is Unmuted"
end if
end tell
end tell
end tell
end tell
end tell
do shell script "/bin/echo -n " & c & " | nc -4u -w0 localhost ${2:-1738}"
display notification (diag) with title ("Toggle zoom audio")
on error errMsg number errNum
display dialog (errMsg & return & return & errNum) ¬
buttons {"Cancel", "OK"} ¬
default button ("OK") ¬
with icon caution
end try
on notInMeeting()
if application "zoom.us" is not running then return false
tell application "System Events"
tell process "zoom.us"
tell menu bar 1
tell menu bar item "zoom.us"
tell menu 1
return (enabled of menu item "Join Meeting...")
end tell
end tell
end tell
end tell
end tell
end notInMeeting