Automators 1: Automating Calendar Events

Great first episode!

One question regarding the Workflow. Is there a way to add multiple reminders to a created event?
For doctor’s appointments that are scheduled way in advance I usually add a reminder 2 months, 1 month, 1 week and 1 day in advance.
Just to be able to reschedule if my plans change

Sadly not, Fantastical for iOS supports adding multiple reminders to one event but I haven’t yet found a way to script that. The built in Calendar app only supports the one alert as far as I know. As a workaround you could create a reminders list called “upcoming events” and have Workflow add reminders to those - but of course these won’t change if your event changes.

2 Likes

Thanks for the great information - because of this new podcast I was able to automate the scheduling of courses I teach each quarter. I look forward to learning more in the future.

1 Like

An excellent start to the Automators podcast! May this be the first of many!

1 Like

Fantastic first episode, Rose and David. I’m sure that this will be one of my favorite podcasts. Thanks so much for your time and effort sharing these resources with the Apple community. You two are superstars!

Since Workflow/Shortcuts will no doubt be regularly featured, I thought it would be a good time to share Backup & Restore My Workflows.

This Reddit post includes a page that describes the workflow features: https://www.reddit.com/r/workflow/comments/897hce/backup_restore_my_workflows/

Or the workflow can be directly downloaded here.

3 Likes

Great episode lots learned and loads of workflow ideas to play with

Using all @Sal 's advice (thanks :smile:) here is the (hopefully) final script to bulk import events into stock MacOS Calendar app. Since all popular calendar apps use the same database, it works also with Fantastical etc.with the additional flexibility for those who use just the stock app.
You can also specify multiple alarms, as requested above by @leo. I included support for only two in my script, but if you need more, just add column(s) in the Numbers sheet and adapt the script by adding additional line(s) for third etc. alarm(s).

Bulk import of events into Calendar


tell application "Numbers"
    activate
    try
        if not (exists document 1) then error number 1000
        tell document 1
            try
                tell active sheet
                    set the selectedTable to ¬
                        (the first table whose class of selection range is range)
                end tell
            on error
                error number 1001
            end try
            tell selectedTable
                set theseRows to the rows of selection range
                repeat with i from 1 to the count of theseRows
                    copy the value of every cell of item i of theseRows to ¬
                        {eventName, eventLocation, startDate, eventDuration, endDate, eventNotes, eventAlarm1, eventAlarm2, calendarName}
                    tell application "Calendar"
                        tell calendar calendarName
                            set newEvent to make new event with properties ¬
                                {summary:eventName, start date:startDate, end date:endDate, location:eventLocation, description:eventNotes}
                            tell newEvent
                                make new display alarm at end with properties {trigger interval:-eventAlarm1}
                                make new display alarm at end with properties {trigger interval:-eventAlarm2}
                            end tell
                        end tell
                    end tell
                end repeat
            end tell
        end tell
    on error errorMessage number errorNumber
        if errorNumber is 1000 then
            set alertString to "MISSING RESOURCE"
            set errorMessage to "Please create or open a document before running this script."
        else if errorNumber is 1001 then
            set alertString to "SELECTION ERROR"
            set errorMessage to "Please select a table before running this script."
        else
            set alertString to "EXECUTION ERROR"
        end if
        display alert alertString message errorMessage buttons {"Cancel"}
        error number -128
    end try
end tell

To Use:
Copy the Numbers sheet to your Mac.
Enter/copy events (duration and alarms have to be entered in minutes).
Specify the name of the calendar you want to import into.
Select the rows you want to import.
Run the script.

4 Likes

Check to see if it support normal importing. Should work with csv-files.

We’ve been looking at those, and of course IFTTT will work on Android (and is actually more powerful on the non iCloud calendar options), we do have a section of this forum for Android though, and I hope we can find out more about the tools that you can use on Android for things like this!

Great episode! Wondering if the fantastical numbers sheet will be shared?

It’s in the blog post!

Thanks! didn’t catch there was a blog!

Question:

I have a mostly fixed schedule, but with varying start times. I’d like to be able to make a schedule for any day based on a start time and have it schedule everything out from that start time.

Ex.

Start time: Varying
Block 1: +30m from start time
Block 2: +1h
Block 3: +2h
Block 4: +2h
etc.
etc.

So far what I’ve done is modify Davids workflow for his time blocking and just insert the start and end dates manually, but it gets pretty tedious.

I’d like to be able to do it manually. I haven’t been able to figure out a way using workflow. Is there a way to do it?

Have a look at this as an example:
https://workflow.is/workflows/24b35731dd8942c39bbc4001d9bbe4a3

Essentially you’re going to need a fair few “adjust date” actions - and make sure the date magic variables are set to time only :slight_smile:

1 Like

New Workflow - Things to Calendar

OK… so this episode inspired me to go fix a problem I was having. On the Mac, I like to plan my day with dragging Things tasks over to my calendar to block time for work. On iOS, that is not possible. Since I am now doing my planning on the train going in to work, I needed a solution.

What I did was create a Workflow share extension that takes a task from Things, and adds it to my calendar. When I share the task, it asks me when I want to start it, and defaults to a 30 min block of time. I have a chance to change that prior to saving it. It is basic, but it works.

I wish I could grab the task link, or separate the title from the Notes… but for now, this solved my problem. Sharing with all of you lovely people.

https://workflow.is/workflows/df661881e1a74faa8ab56af0401fc3c5

2 Likes

Is there a way to make events “all-day”? I schedule the events each year for my department, and many of the events are all-day, several days, or even all-week long. Is there a way to add a column or a variable or a checkbox (something!) to the Numbers table so that it enters those events correctly?

Currently, I’ve been doing this the other way: make all the events in the calendar, and then export it as a .ics, then using Free ICS to CSV Converter convert it to CSV document, which I can then convert into a spreadsheet. Most (all?) of my colleagues are on Macs/iPhones and so being able to import a calendar into their system is ideal. But some colleagues really like to see the events as a table, just like the Numbers spreadsheet.

From memory if you skip the duration it should default to an all date event.

Yes, there is, through a Boolean variable. I was thinking about adding it to the table and then I decided to wait until someone asks for it :smile:. Or maybe it can be cheated by skipping duration as @RosemaryOrchard suggested. Will look into it.

3 posts were split to a new topic: Editing an event with Workflow

This should do it:

New version of the Numbers sheet supporting all days events

New version of the AppleScript

5 Likes