Photo by Glen Carrie on Unsplash
Automate opening zoom links when they start so you're never late for a meeting
First why even?
I'm usually in a state of flow before my standup meetings. I typically never wait for them to start so I wanted to figure out a way to automate opening my upcoming zoom calls for me so I would never have to cram trying to open up my calendar and look for the meeting link.
This blog expands on the functionality behind running applescripts that are triggered by apples version of cron jobs - launchd as well as introduces some of the power the shortcut app has to offer.
With this you can automate setting up the applications you would need to work every weekday at a specific time. You can learn how to get that setup here.
So how can I never be late or miss a zoom meeting again? Demo ๐๐ผ link to youtube. But the script will pop open the zoom link and become your active current window and give you the option to join it or not.
What we need
- Calendar
- Zoom
- Shortcuts App
- A browser (Google Chrome, Safari, etc..)
- LaunchD
Typically in any calendar, zoom links are either referenced on the event location or event url. Depending on where your zoom link is stored, you would need to change some variables accordingly(this is simple to do). I have all my zoom meetings scheduled so all I really had to do was connect my google calendar to my iCalendar. You can learn how to do that here.
How does it work
We will create a macos shortcut which would do all the heavy lifting for us. Here is a link to install onto your shortcuts app - shortcut
Explanation
We are going to get the upcoming event and grab a couple details - location
and startTime
location will be parsed so we get the string of the url itself. We will then compare the current time with startTime to determine if the event itself is something that about to happen. For this example, the shortcut will check if the event start time is less than 60 seconds. You can modify this according to how long before you want this script to trigger.
Next, we will add some scripting to programmatically open our link with Google Chrome with some string checking. If the string has zoom
in it then we will open the link with google. This will prompt our zoom application to open.
Now we have the pieces of opening zoom when there's an upcoming event, so how can this script be triggered programmatically? We need to poll (how often we want a script to be triggered) this script. For this example, polling every minute makes sense. Every minute I want this shortcut since the shortcut checks if a calendar event is 60 seconds of starting which should give us enough time for the script to tell that an event with a zoom link is about to begin.
I'll admit I don't know how much this (polling every minute) will affect your computers performance but keep in mind you can adjust the interval to however long you want. But, I did not see any drop in performance on my machine with it on.
To poll
We actually need two things.
- A script that calls the shortcut.
- A launchd file which is like macos's cron job toggle.
A more in depth guide on using applescript and launchd is written here.
FilePath = Library/Scripts/Personal/zoom-auto-open.applescript
tell application "Shortcuts" to run shortcut "OpenZoomFromCalendarEvent"
Write your script in a place you would normally store your scripts. I would recommend somewhere inside your systems Library
folder.
Now we need to create a .plist file inside Launch/LaunchAgents
I called mine zoom-auto-open.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.zoom-auto-open.plist</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/osascript</string>
<string>/Library/Scripts/Personal/zoom-auto-open.applescript</string>
</array>
<key>StartInterval</key>
<integer>60</integer>
</dict>
</plist>
Here are the docs for launchd. But for the most part, this is straightforward. I want to call my program which is listed under the ProgramArgument
key which references the filepath of where my applescript is held. This applescript is the one-liner that runs the shortcut.
StartInterval
is used to indicate how often I want to call this script.
Load up the script with launchctl
. Please refer to the docs on how to load and run scripts but if you are having trouble with loading which I have experienced you can run the free trial of launch control. This program is a gui interface for setting up your launchAgents and launchDaemons.
How can this improve?
- Turn off spotify before joining. I joined a meeting with my spotify playing because I muted speakers and forgot I had it running in the background. When I raised the volume my song just blasted. It was quite embarrassing.
- Set volume to 100%. So I can hear everyone clearly(I don't use headphones).
Conclussion
If all works well, you now have a nice popup that shows your upcoming zoom link. To test it out, just adjust an event on your calendar to start 2 minutes before. Wait a little bit and boom you should have your zoom link popup.
While this is one practical way of utilizing shortcuts, calendar events, applescript with launchd, I am certain you can come up with awesome solutions to stay organized or optimize your productivity.
๐ฌ๐๐ผ Comment down below how you think you can use these cool macos features!