Calendar Travel Time

I’m trying to create a shortcut that will ask me for a location (which can be from a menu or user input) and then add a calendar event with travel time added (like the Calendar app does).

Whenever I add a location, I don’t get a map like I do if I add an event manually, and I can’t seem to set any travel time options.

I also want to create an alert 2 hours before the travel time.

Is this possible?

Any help would be greatly appreciated! Thanks!

Here’s something to get you started, but you may well need to specify you destination calendar in the Add New Event action towards the end.

What it does do

  • It offers some locations to travel to, including other where you specify a location on the fly.
  • It offers some locations to travel from, incuding a pre-defined address, current location, and an address you can specify on the fly.
  • It asks you to specify your transport mode.
  • It will capture the start time, end time and title for the event.
  • It will shift the event start forward by the travel time duration, but keep the specified end time.
  • It will set an alarm to trigger two hours before the travel time begins.
  • I’ve included a menu at the end to help view the data around what’s going on without filling your calendar with trash events. If you select the ‘testing’ option, the Shortcut will display a page of information about the calendar event it would have created. This was how I tested it as I went along building it.

What it doesn’t do

  • Add a map.
    • I don’t see an option in the Add New Event action to add an attachment and the notes field looks to be text.
    • To mitigate this, I included a URL in the notes that is a link to a map of the destination address; but see also the things to note below.
  • It doesn’t provide travel time information for when you are travelling. It provides it for right now, as it is using the functionality built into Shortcuts/iOS. You would need to use some third party service perhaps to do it for another time, but because traffic incidents and poor weather conditions can occur and are not necessarily possible to account for, even then the accuracy would be questionable.

Things to note

  • As noted above, travel time is based on current information such as traffic. Whilst it may be a useful approximation sometimes, it will never be as reliable as figuring out travel time closer to the actual event time.
    • As an alternative, I might suggest something like always adding X% on to the travel time to give you a travel buffer in case conditions are worse. You could even specify this as a confidence level thing when you are entering the data - e.g. a manu where you specify a level and it applies a percentage increase (0%, 5% 10%, 20%, 50%, …) to the trave time before you use it.
  • When travelling by public transport, remember that the travel time is not necessarily giving you all the details you would need for that journey.
  • Travel time does not include the time necessary to transfer from vehicles, actually find the precise location of an event within a venue, etc.
  • I personally find travel time best specified as a separate event. It allows an accurate understanding of when the original event is taking place, and when using public transport, it allows me to get specific details in the separate event.
    • As an example, I have a couple of shortcuts that I use for entering my rail travel (UK). I put in the starting point, the ending point and specify all of the intermediate stops and timings. For each I’m prompted for my seat, and this is particularly useful for split ticket journies; paying for multiple steps in a UK rail journey can often save money over buying a point to point ticket. The shortcut also captures my booking number for my tickets, adds times and alerts for picking those up on the day, can put in travel times to the station from my house for a taxi or bus. I then have all the detail I need and my colleagues at work can tell precisely where I should be at any time during my day … which sadly can be a necessity in terms of a duty of care in current times.
  • If you use an alternative calendar app like Fantastical, it will put in a map based upon the location of the event.

Hopefully this gets you at least part way to the sort of custom shortcut you want to build.

1 Like

Thanks for this!

It gets me quite a lot of the way there which is brilliant.

The automatic mapping function in Calendar works as follows:

It’s this functionality that I’m trying to get to work, but I’m not sure that there is a way to do it from Shortcuts.

If it is, do you know how to?

Thanks again… I really appreciate the help!

If you read back through my previous post, you’ll see I’ve already responded to that specific aspect … but I’ve also had a bit more of a dig around an I think I can now provide some more detail.

It looks like when a new event is created with a location in the Apple Calendar app on iOS, it builds an x-maps-mapitemhandles link based on the address entered. This is a serialised version of a map item and this is something that isn’t natively available in Shortcuts; at least not at the level where we can directly generate the serialised URL.

  • I tried adding a standard maps URL in as the location in case Calendar could interpret it as an equivalent. It couldn’t.
  • I tried to come up with a way to manually generate a map item (for serialisation), but I wasn’t able to find anything documented to allow me to proceed with this approach. It’s all bundled into Apple’s location libraries which isn’t something we can work with in Shortcuts and isn’t something I can reverse without a lot of time and/or more (or rather some) information.

Unless someone knows how to work with the above elements within the current Shortcuts range of functionality, I think my workaround of the URL and/or my suggestion of using something like Fantastical still provide you your most practical options.

Thanks for digging around! I really appreciate it.

I’ve just bought Fantastical on iOS but, to be honest, I still can’t get it to work.

Is there a way of getting Fantastical to do the heavy lifting here?

I’m more than happy to do whatever it takes if this is possible as it will save me hours and hours of work over a period of time - if I can just get this one thing right! :slight_smile:

Here’s an example of an event created using the previous shortcut (just excluding the map link to illustrate it isn’t that data that Fantastical uses). As long as the address is populated meaningfully, a map should be embedded in the calendar. Tapping on the curved arrow after the address will also open into the mapping app specified in the Fantastical settings.

If that doesn’t cover your issue, can you explain specifically what you haven’t yet been able to work out?

That should cover it… I’m just unsure how to modify the script to use Fantastical instead of the built in calendar.

Could you help me with that bit please?

Again - thank you for spending the time on this - I really do appreciate it.

You shouldn’t need to change anything. Fantastical and the iOS Calendar app can share the same calendar provider.

For example if you were using say Google as your backend calendar and had the Calendar app pointing at it, you would just point Fantastical at it too.

Take a look at the calendar list under settings in the Fantastical app and you should see some familiar looking calendars. See also, Getting started with Fantastical, by Flexibits.

My mistake… I thought I would need to change the script to use the “Add Calendar Event With Fantastical” action :smile: