Jim's Add an Event to Apple Calendar Macro:

Great. Thanks Chris. I am halfway to incorporating this into the complete AppleScript... I will post back once I have it working. Looks very exciting as it happily takes "tomorrow", "next Wednesday" "Monday" as inputs and correctly converts them to dates Calendar can use. I have had to change it from making ISO format to dd/MM/yyyyy as Calendar got confused by ISO.

1 Like

UPDATE - Thanks to a combination of AppleScripts and Macros by @ccstone and @JMichaelTX I have got the Date Parsing working.

Now I can enter the date for the Event in lots of Common English terms, rather than having to type something like, "28//09/2021"

I can type "tomorrow" or "next thursday" or "monday" and the Macro will convert them to a form that Calendar can use. It makes using the Macro really intuitive.

UPDATE 2 - I've included a Checkbox to set an Event for "All Day" with the reminder time off-set. This AppleScript gleaned from @michael_e's solution in the threads above. (The Checkbox is unchecked by default, but clicking in it will make an All Day Event in Calendar.)

Instead of one mammoth AppleScript I broke the Macro into Keyboard Maestro Actions - which made it simpler to edit, troubleshoot and maintain (also for others to adapt to their own specific Calendars and Locations).

I learnt a lot about the Prompt for User Input Action in the process of doing this.

One little subtlety that I didn't know before is that in a Prompt with List entry, if an item is duplicated in the list at the start it becomes the default selection but still keeps its place in the dropdown list:

"11:00|09:00|09:30|10:00|10:30|11:00|11:30|12:00|12:30|13:00|13:30|14:00|14:30|15:00|15:30|16:00|16:30|17:00|17:30|18:00|18:30|19:00|19:30|20:00|20:30|21:00|21:30|22:00|22:30|23:00|23:30" will use "11:00" as the default selection.

And putting a double underscore after an Entry will allow the display of a more user-friendly Prompt. So, "-1440__1 day before" shows "1 day before" in the Prompt but selects "-1440" as the actual value. (Calendar needs the time in minutes but as a human, I find it nicer to think in hours or days :smiling_face:︎)

And being able to make a Checkbox in the Keyboard Maestro Prompt for User Input Action is great too (and made use of the the "All Day" toggle in the Macro).

@Jim, I know you prefer the AppleScript Dialogs to the Keyboard Maestro Prompts - but I have found the Keyboard Maestro Prompts more flexible and a lot easier to edit than the AppleScript ones. They also exploit Keyboard Maestro's great strength as a modular system of Actions where different techniques can be used in one Macro, reordered etc.

I have used a series of Keyboard Maestro Prompt windows -

the first to enter the date
the second to enter the event name
the third to enter the time
and a fourth prompt for information that I can just leave blank if I want.

I found this was better than having just a single Prompt window or a Prompt for every single bit of info. And the great thing is that it's easy to drag these Prompts into a different order or combine them in the future.

EXAMPLE Calendar ⇢ Create New Event (with Date Parsing and All Day).kmmacros (48.0 KB)

1 Like

These lists of Calendars, they're only apple calendars and not available named Google Calendar calendars, correct?

I just posted here:

I'm hoping to find an easy KM solution to add GCal events from my daily flow.

Thanks.

Correct. Since I don't use other calendars, I did not invest time into supporting them.

1 Like