Six Colors
Six Colors

by Jason Snell & Dan Moren

This Week's Sponsor

Clay - A beautiful relationship manager for macOS and iOS, built automatically from email, Contacts, calendar, iMessage, LinkedIn, and more. Try it free for 60 days.

By Jason Snell

When two calendars are not better than one

Speaking of Shortcuts, last weekend my pal Lex Friedman (who just started his own consulting business!) asked me to see if I could help him solve an automation program.

Lex wanted to use this shortcut to quickly generate a list of times where he’s available for meetings. This is a great use of automation—I wish I’d thought of it. Unfortunately, the shortcut only checks a single calendar, and Lex wanted his availability judged based on entries in two different calendars.

I thought of a million ways to attack this problem, but in the end I tried to keep it simple and just modified the existing shortcut. But here’s the problem: While there’s an action in the Calendar app that lets you filter calendar events based on criteria you choose, it doesn’t support both and and or logic.

So how do you find all (for example) all all-day events in a date range, in a specific calendar, containing some specific text in their title? You can’t just add a second calendar there, because the events are generally on one calendar or the other, not both.

I thought the solution was to first find all the events that match the criteria, regardless of calendar, and then place a second filter action that limits to one of the two desired calendars. Seems like it should work, but I just couldn’t get it to. Something fishy is going on there.

Here was what worked: I duplicated the Find Calendar Events action, making two separate actions, one for each calendar. I placed the results of both actions in a variable, and used the variable for the rest of the script. (In the case where I needed to sort the two sets of items together, I added a third filter action that takes all the events in the variable and sorts them together.)

This is pretty unwieldy. I don’t understand why my attempt to filter the filtered items failed, nor do I understand why Apple hasn’t allowed more sophisticated filtering actions. (To be fair, I also don’t understand how Fantastical—the app that Lex and I both use on macOS and iOS—doesn’t offer any actions like this one!)

In any event, if you need to get in touch with Lex, here’s how. I’m sure he’ll tell you when he’s available.

If you appreciate articles like this one, support us by becoming a Six Colors subscriber. Subscribers get access to an exclusive podcast, members-only stories, and a special community.


Search Six Colors