A 'holiday' shortcut / script idea - is it feasible?

Hi guys I’m wondering if the following is possible…

  1. I manually create a note on the Mac called ‘Start’, within that note I have addresses on each line.
  2. Again create a note (named ‘Visit’) with and in that on each line I have addresses of places we’re considering visiting
  3. The ideas is that a script (or preferably Apple Shortcut) can run and generate a new note - called, say distances, which will contain within it data comprising as a title the start address, and underneath it the addresses of each visit location - added to the end of each line would be how long and it would take to get there and how far.

I’ve no ideas if any of that is feasible at all, if it was it’d cut down a great deal of work whilst investigating locations we’d like to visit when booking holiday cottages.

Any thoughts would be very much appreciated.

dbrewood. I’ve included a shortcut below that generally does what you want, but there’s an issue.

The shortcut uses two notes, which must exist and have the titles Travel Locations and Travel Data. The Travel Locations note contains address pairs which consist of the start and destination addresses. There can be blank lines between but not within an address pair. The Travel Data note repeats the address pair with travel time and distance appended.

The issue occurs when the server cannot find an address. When this happens, the shortcut simply reports an error and stops, and there’s no way to handle this error within the shortcut (that I’m aware of). The best approach is to input the address pairs in the Travel Locations note one at a time or in small numbers. That way you can refine the address when there’s an error.

The following are two address pairs that I successfully used for testing purposes. I’ve tried other address pairs without issue, although they were all in the United States.

201 South Cortez Street, Prescott, AZ
100 South Entrance Road, Grand Canyon Village, AZ

200 North Spring Street, Los Angeles, CA
1313 Disneyland Drive, Anaheim, CA

The following screencapture only shows a portion of the shortcut:

Travel Information.shortcut (24.0 KB)

Many thanks, that is greatly appreciated. As you say there are a few issues with addresses being in the right format.
As an example I can’t get a valid format for ‘Scalby Lodge, Burniston Road, Scarborough, GB YO13 0DA’ which is the correct address for a holiday let we use. Anything I try gives a ‘Get Distance failed because Shortcuts couldn’t convert from Text to Location’ error.

A typical data pair I’ve tried to use is (address now got from Apple Maps:)

Scalby Lodge, Burniston Road, Newby, Scarborough, YO13 0DA, UK
Burnby Hall & Gardens, The Balk, Pocklington, York, YO42 2QF, UK

I put that address into Apple Maps, and it did find the desired location. The Shortcuts app has a number of location actions ( e.g. Get Addresses from Input, Street Address, Get Maps URL), and it appears that the addresses from the Notes app have to be filtered through one of those before being input to the distance and travel-time actions. I’ll work on that.

Thank you, anything you can achieve would be great…

dbrewood. The Street Address action appears to be what is needed, as demonstrated by the following screenshot, which recognizes one of your sample addresses:

I edited the existing shortcut to incorporate this action for US addresses, and it worked fine:

Travel Information.shortcut (24.5 KB)

I am not familiar with English address formats, so you need to tell me how you want to parse UK addresses and to populate the fields in the Street Address action. If you would prefer to edit the shortcut on your own, that’s fine of course.

Thanks… Using the Travel Location of:

Scalby Lodge, Burniston Road, Newby, Scarborough, YO13 0DA, UK
Burnby Hall & Gardens, The Balk, Pocklington, York, YO42 2QF, UK

I get error:

And these are properly formatted UK addresses.
Place, Street (or area), Town, City / County, Post Code, Country.

Sorry to be a pain…

dbrewood. My second shortcut uses a Street Address action, and it works with the address format common in the US, which is STREET, CITY, STATE, POSTAL CODE, COUNTRY. This shortcut will not work in the UK.

Apparently (and I’m not sure of this), the Street Address action in the UK differs from the Street Address action in the US (e.g. the US has states and the UK does not). If the Street Address actions differ, I don’t know how I can write a version of the shortcut that works in the UK.

In my testing, postal code is not essential, so a typical Street Address action in the US version of my shortcut is:

I don’t think editing my shortcut to work in the UK is difficult, but I’m not sure I can do that. Perhaps a US city is equivalent to a UK Town, and perhaps a US state is equivalent to a UK City/County, but I don’t know that. So, I’m at a bit of a loss.

Understood, thanks for your efforts, I did try to work out how to get the ‘address screen’ you have in maps but could not work out how to get the ‘street address’ data.

US city is equivalent to a UK Town, and a US state is equivalent to a UK City/County. You are correct on both.

I’m more than happy to leave the idea here, I don’t want to put you to too much work… :slight_smile:

Thanks–that will be fine.

Just as a point of information, I created the address screen by starting a new, blank shortcut, and adding a Street Address action and nothing else. I then populated the fields in the Street Address action as best as I could determine and ran the shortcut, which returned the map shown. I did this for testing only to hopefully determine what address components belonged in what field.

Right, I’m with you now :slight_smile:

For future reference in the UK that street address action changes to:

1 Like