Automators 1: Automating Calendar Events

I use Fantastical and how it works is detailed in this video:

However there is an AppleScript in this thread that works with the calendar app and the same spreadsheet:

1 Like

I use week cal, is it possible to have a short cut ask me questions about something I want to add for an event. I have a great picture of what I want to do in my head but I don’t know how to do it. I want to make it similar to the video that @MacSparky made of using shortcuts as your menu for everything on your phone, but I only want to do it for the calendar.

I found the correct syntax. It is ā€œmissing valueā€.

So I’ve figured out why the KBM macro would only add the last event, it was because KBM was trying to add them too fast. Here’s the updated script that works.

tell application "Keyboard Maestro Engine" to set myEvent to getvariable "Event"

tell application "Fantastical 2"
    parse sentence myEvent with add immediately
    delay 1
end tell

Also, if you want to go nuts like I did, you can use this RegEx to allow you to paste in events from rows and columns (not just rows like the example), by turning tabs into newlines. I use the spreadsheet to create multiple events based on one original date, and this allows me to do this.

@RosemaryOrchard How come in the Numbers spreadsheet, the formula is using ifs and isblanks with concatenation vs solely using concatenation? I used concatenation and it seemed to work just fine. This is completely an intellectual question.

That’s because depending on what you put in the columns it might not work with the blank things - I am adding words. Plus this way if you want to paste the event list into an email it’s already pretty

Yes, the concatenate only is definitely not as pretty. I also added a column for time starts and just added cell references to include that column and it worked beautifully.

I will put up a web page showing the shortcuts I made to make my automation work. An email comes in once a month with dates and a titles of two movies. I wanted this to be automated. Did it with Shortcuts and use Regex along the way.

I made a video demonstration of the Shortcuts made in the Shortcuts app. I took the body of an email and sent it into the automation. Out of the other end I had 2 calendar events. I used Fantastical within Shortcuts ot make it work. I even got fancy by having the main shortcut run 4 shortcuts in it to parse the text the way it was needed to make it work in Fantastical.

Love using automation. Learned a lot about Shortcuts app and had to think like a programmer to make it work. Took ages to set it up and it will take a long time to get back the time in savings from using the shortcut. But - I had a great learning experience.

1 Like

Does anyone have a shortcut that I can search certain events every month and it puts it in a list order?

@Jjm, can you clarify what you are looking for?

What do you mean by ā€œcertain eventsā€? Do you just want to search for some text in the title, events that are of a particular length,…?

What do you mean by ā€œlist orderā€? Display what information in the list, just the name for example; and what order do you want? Chronological, alphabetical, and ascending or descending?

For the list is it just a list that you want to view, like an itinerary, or is this an actionable list where you want to select one or more events and do something with or to them.

@sylumer good questions. I would like to search a month or more at a time for my overtime at work. When I work it I add it to my calendar as a separate event in the title.
Then I would like to put it in order of when I worked it, for example…
Jan 1 9 hours
Jan 5 6 hours

Here’s an approach that might work for you.

Specify the calendar and the search term in the first action. The shortcut then loops over the returned events, extracts the start time, and calculates the duration. In both cases I’ve set the formatting to match your output specified in your clarification post.

Please note that the shortcut will ignore days of duration as you are assigning overtime to specific days and also seconds as it is not significant to specify any event time at that graularity, if you are then reporting it back in hours. i.e it only process hours and minutes of duration.

Expand to show shortcut details

Hopefully that’s a good starting point for you.

Thanks @sylumer I will try it out

Just curious why this message comes up. I know someone probably asked this question, but I forget what the answer is.

You should put the ā€œask for inputā€ date in the end time too, and double check to make sure it’s formatted as just the date :slight_smile:

6 pm refers to the day you are creating the shortcut :wink:

Wouldn’t it be the date the shortcut was run, rather than the date that the shortcut was created? :thinking:

Is it possible to add events to a shared calendar? I tried and it came up with an error. 20

Ok now I’m getting the boolean error as above by @jplacek. I’ll redownload the numbers sheet to see if that works otherwise I’m a bit stumped.

Hello,

This isn’t my shortcut but I think its pretty great. I have a couple questions.
Do you have to use a variable for the date?
in the ā€œAdd New Eventā€ it says ā€œdateā€ next to the time, could you just use a ask when run? would that do the same thing?
How do you get the time to stay set to the specified times? when I try to make an add new event on my own it will give me the time the it is now, not the time that I have in the event.

https://www.icloud.com/shortcuts/d0832fec66ab4747892363a24618ea62