Search code examples
macosapicalendar

Accessing macOS Calendar events to calculate hours worked


I’d like to add up how much time I spend working each week.

I keep track of when I work by entering an event in a dedicated calendar that I subscribe to in macOS/iOS Calendar.

My first ideas were:

  • Is there a way to do this with Shortcut (the new Automator?)
  • Is there an AppleScript approach to take?
  • Maybe I can form or access an API that serializes the calendar event objects to a format I can consume in another programming environment like Ruby or Smalltalk?
  • Should I skip trying to use macOS calendar and see if I can authenticate to the calendar feed and work directly from there with a calendar library?

Thanks in advance for an ideas you might have!


Solution

  • I figured it out using Shortcuts, the new version of Automator!

    Here’s what the program looks like:

    A macOS Shortcuts program calculating hours worked in a calendar