I want to execute some actions based on whether or not specific calendar event is due in next x hrs.
Is it possible?
In my case, I want to append a line (Duration of the event - Name of the event) to a text file if a specific calendar event is due today. Thus, I need such a list of event duration and name in a text file about the all the calendar events due today.
It would be great if there is a choice to choose which calendars to seek for. Because I have multiple calendars and events from some calendars may not be relevant to my purpose. Here's what I mean by multiple calendars:
Have you looked into Apple's Shortcuts app. Lots of calendar actions.
In KM you can use 'Execute Shortcuts' action, then dump into a variable and go from there.
Hi, @fluid_eye. As @Steve_E suggested, a macOS Shortcuts application shortcut can be combined with a Keyboard Maestro application macro to achieve your objective. Specifically:
In Shortcuts check out the action named Find Calendar Events; with it, you can specify a range of dates (which can include times). You can add additional filters which can include the Calendar(s). With that filter values you could hard code the filter, specify Ask Each Time or use a variable from above action (e.g., the result of a Choose from List action). As an example, I have a shortcut that checks four of my calendars and sends me a text message that includes all entries for the following day (between Specified Dates: Tomorrow 00:00 to Tomorrow 23:59).
Picking up on @Steve_E and @_jims really good suggestion to use an Apple Shortcut to get the list of today's Calendar Events into a Keyboard Maestro Variable, here is an example of how that could work.
@fluid_eye, even though it doesn't directly apply, in the spirit of @Zabobon (who sets a very high bar in this forum! ), I thought I would share one of my calendar-related shortcuts, especially considering I've discovered a few Shortcut app nuances over the years.
The method used in @Zabobon's example shortcut seems more logical and is what I used for many months. But in cases where the object in the Repeat for Each action includes many items, the Combine Text method will yield a noticeable performance improvement.
Not useful for me for this particular use case but I might definitely need to refer your answer in the future so thanks for sharing.
In that case, I wonder if you'd have something to guide me to, to include summation of durations as well. In this same use case that I mentioned in the question, I would also like to have a summation of the durations of these events. For instance if I have a list of 5 events. Duration of each event may differ. I want to see what is the total duration of these events combined. Is it possible to get that number displayed along with the list of events?
Tagging @Zabobon as well, in case he/she/they have any inputs to share.
This is the output I am currently generating. It would be great if it could also have a number showing a total combined duration of these events. Either using siri shortcuts or KM.
I use the output of siri shortcuts into a KM variable to display it in prompt for user input action
That works. You're amazing.
Can't thank you enough.
I wish I could highlight your response as well to give you credit and express my gratitude. but it seems we can only put one response as a solution to our question. But your response means a lot to ME. Thank you.
Let me know if you are active on any other forums with regards to siri shortcuts or if you create content (A YouTube channel etc) about it. I'd love to follow you.
Disclaimer: Since iOS 14, I’ve cut way back on my shortcut development*. Although many of the macros I’ve shared on RoutineHub still function as expected, I’ve not officially tested any beyond the versions noted in the Information section of each post.
*With each version of iOS and macOS, Apple tends to break key features of shortcuts and the Shortcuts applications; sometimes they fix them, but many times they don’t. It’s been very frustrating and a stark contrast to Keyboard Maestro which is always rock solid and has great support.