Copying dictionary template to re use

Hi Guys,

I have a Calendar shortcut that I found somewhere and modified for my own needs. I wanted to add an entry just now and couldn’t find anyway to copy one to the other and ended up having to re type it all manually. I’ve recreated it as best I can down below. What I would like is a way to copy the headers to a new entry so I can just enter the relevant details. Is this possible?

Dictionary
Doctors appointment: 6 items
Calendar (text)
Location (text)
Duration (text)
Notes (text)
All Day (Boolean)
Alert (text)

If you are duplicating within a shortcut and want to add to the same shortcut, tap on the action header and select “Add to this shortcut”.

If you are creating a new shortcut, you could duplicate the existing one on the list page by selecting edit, tapping the original shortcut, then the duplicate button at the top.

Another way that can work anywhere involves using a particular format known as JSON. Dictionaries can be expressed in plain text in JSON format. But rather than having to know how to build it, you can just build the dictionary as normal, then add a copy to clipboard action. This will automatically convert it.

To change it back, use a Get Dictionary from Input action. This means you can convert it, paste it into a text action anywhere you like, modify the content (it isn’t difficult), and then use the Get Dictionary from Input action to prepare it for use.

To illustrate this I put together a little example

Hope that helps.

4 Likes

Thanks, I didn’t know about the “duplicate within shortcut” so that was very useful.

I’ve installed your shortcut and will look through it more thoroughly a bit later. I was struggling to explain myself in my original post but the dictionary you’ve created has the headings I mentioned as individual entries whereas mine has them as a sub category of the original heading so for example

Doctor appointment

Calendar, Location, Duration, Alert, Notes etc

So I have a bunch of these in the shortcut for example doctors, dentist, physio, client sites etc I would love to give this to other people I know in my life but there has to be a way to tap “Doctors” copy it and have the sub categories auto filled out ready to go.

Exactly the same principles apply. The content of the dictionary is irrelevant in regards to the techniques as they concern the top most dictionary level.

Once you have the text, you can even copy and paste within the dictionary JSON to replicate entries within it… which I guess might be another interpretation of what you originally asked for.

If you want to copy a dictionary within a dictionary, either JSON it all and trim it down or just grab the sub dictionary you want and apply it to that.

1 Like

I understand the concept of converting to JSON and back and for me personally it’s fine to do it that way. However, I have some Muggle friends and relatives that could benefit from this Shortcut, but don’t even grasp the concept of JSON, let alone are forced to compile a JSON object.
So like the original poster I am wondering if there is a way to duplicate an entry in a dictionary that in itself contains a dictionary. In iOS 13.1 I cannot find the ‘duplicate and add to this shortcut’ option any more.
BTW the Shortcut the original poster referred to, I think, is Macstories’ Create Calendar Event from Template: https://www.icloud.com/shortcuts/3dd4ee24e43f464f92adaa70a0311eaa

Found on this page: https://www.macstories.net/shortcuts/#calendar

Why not build it as a text string or set of strings and programmatically add it to the JSON? Then they can edit that bit as text or user input.

That sounds like a plan. I’ll see what I can come up with based on stock Apple apps, because I cannot ask the Muggles to buy Drafts or other apps just for this feature.

You could capture/set the text at the top of the shortcut.

You could create a shortcut to help them build the text and store it in an iCloud file you then read in within the original shortcut.