Rather than using a subscription based utility (like Fantastical), I wanted to be able to add an event to Apple Calendar with all of the details in place.
What follows is my solution, done in AppleScript. It uses multiple AppleScript dialog boxes to collect information (using lists or suggestions), then it creates the event for you. The only option I did not include was an end time. Since my events are most often an hour, I use that as my default.
It even grabs the URL from the front tab in Safari as a suggested URL. I am very happy with it, and felt that it was wroth sharing.
You will have to edit the following to suit your needs:
- The list of calendars (to match the calendars in your app)
- The list of locations (to your most used ones)
- The list of times (as I like 11:00am to 9:00pm—which may not suit you)
- You may wish to change the reminder times (I use 0, -15, -30, -60, -120, -1d, -1w)
- The defaults (set them to your own preferences)
I hope that you enjoy it. Here is the AppleScript, followed by a downloadable macro, that you can import into your Keyboard Maestro library.
set theDate to short date string of (current date)
tell application (path to frontmost application as Unicode text)
set varCal to (choose from list {"Things", "Magic", "Gaming", "Home", "Social", "Travel", "Webinar"} with title "List of Calendars" with prompt "Please select a calendar" default items "Things" OK button name {"Choose"}) as string
end tell
display dialog "Enter the event:" default answer "Appointment with "
set varName to text returned of the result
set varLocation to (choose from list {"Home", "Work", "Online", "Store", "Convention"} with title "List of locations" with prompt "Please select a location" default items "Online" OK button name {"Choose"}) as string
display dialog "Enter the date:" default answer (theDate as text)
set varDate to text returned of the result
set varTime to (choose from list {"10:00 am", "11:00 am", "12:00 pm", "1:00 pm", "2:00 pm", "3:00 pm", "4:00 pm", "5:00 pm", "6:00 pm", "7:00 pm", "8:00 pm", "9:00 pm"} with title "List of start times" with prompt "Please select the start time" default items "1:00 pm" OK button name {"Choose"}) as string
set varStart to date (varDate & space & varTime)
set varEnd to (date (varDate & space & varTime)) + (1 * hours)
display dialog "Enter the description:" default answer "→ "
set varDesc to text returned of the result
tell application "Safari"
set varURL to URL of front document
end tell
display dialog "Enter a link:" default answer varURL
set varURL to text returned of the result
set varRemind to (choose from list {"0", "-15", "-30", "-60", "-120", "-1440", "-10080"} with title "List of reminder minutes" with prompt "Please select a reminder time" default items "-60" OK button name {"Choose"}) as string
tell application "Calendar"
set theCurrentDate to current date
set newEvent to make new event in calendar varCal at end with properties {description:varDesc, summary:varName, location:varLocation, start date:varStart, end date:varEnd, url:varURL}
tell newEvent
make sound alarm at end of sound alarms with properties {trigger interval:varRemind, sound name:"Crystal"}
end tell
end tell
F4—Calendar: + an event.kmmacros (3.8 KB)