Parsing ics files

I’m trying to extract meeting titles from fantastical to create meeting notes in draft, but I can’t get Shortcuts to do it. I thought maybe a script in drafts could parse the content of the ics file that fantastical sends through the share sheet.
Does anybody have pointers ?

Do you have a sample file?

In terms of pointers for Drafts, I think you could import and then run an action with some regular expressions to grab the text you want.

I’m terms of doing it in Shortcuts, I wrote a quick example that works for me with a handful of test cases.

Hope the above helps.

Wow, that is convoluted, yet oddly easy to follow. Thanks! I’ll delve into it and report back.

I have a Drafts action that runs a shortcut I found that lets you choose the format of your meeting notes and select the meeting from the current days events. I can’t remember where I got it from and I’m not sure how to share. I am pretty sure it will have been posted originally on this forum so you might be able to find it with a bit of searching.

Not sure all the details, but you can also script reading directly from Calendars. This Import Calendar example might be a good starting point, and likely a cleaner way to approach the problem than manually sharing and cleaning up ICS files.

1 Like

The issue with that, if there is one, is that you have to apply the .ics file to the calendar first. I suspect there are use cases where it’s the raw ICS file that wants processing, without going anywhere near a calendar app.

Thank you all for your pointers. The functional need was “get a list of today’s events; select one and prepare a draft ‘minutes of meeting’ template”.
I’ve ended up using the import events action suggested by @agiletortoise, mostly because it’s a good exercice in JavaScript , but the little shortcuts wizardry suggested by @sylumer is safely tucked away for later perusal.
As soon as I’m satisfied by my action, I’ll post it.
Thanks again!

Here’s the action Make MoM .
Thanks for the help!

1 Like

I am trying to alter this script, making it possible to select all calendar events and not on a specific calendar, also because I have multiple calendars named “Calendar”. Does anybody know how to do that?

Use getAllCalendars() to get an array of calendars, and then simply process each calendar in turn in the same way as the current action (presumably the MoM one). As each calendar is processed, you will probably want to merge the results into a new array (when the results are a non-zero array of events). There are several ways to combine arrays in JavaScript, so I would recommend Googling the options (they will be things like spread operators, concatenations, iterative pushes, etc.) and simply choosing one that makes most sense for hope you are amending the script for your own use and maintenance.

Hope that helps.