Automators 1: Automating Calendar Events

I’m thinking you just simply renamed it to “end time” because it worked!

1 Like

Yup, it’s just a renaming!

1 Like

I’ve just tried the Keyboard Maestro Macro and it only adds the last event in the list, and ignores all the other ones. I’m not good enough with Apple Script to figure out why. Any help?

@RosemaryOrchard you were talking about putting information into a spreadsheet then it adds it to the calendar. How do you do that? I’m looking to do that. But I don’t use Fantastical not sure if that matters or not.

1 Like

Hi Jim,

I am trying to learn AppleScript and I set up a numbers sheet, where you can list all your calendar events and it will then be parsed into the calendar of your choice. The good thing about the script is that you do not need Fantastical and Keyboard Maestro. Once I am finished, I am willing to publish it here.

I hope that anyone can help me with the last puzzle piece I am looking for. The script should advance from row to row until it gets to an empty row, where it should exit the routine.

How do I tell AppleScript, that if a cell is not empty, it should continue with the routine, for example:

repeat while cell 1 of row xxx is not ""
– script goes here
end repeat

What is the correct expression for the “is not empty” syntax?

Thanks for your help!

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: