Is there anyway to pass variables from one Shortcut to another? Would like to use a few shortcuts together and I’m not quite sure how I’d pass the information from one to the other - is this possible currently? Or am I looking at making many more mini shortcuts and using the clipboard to pass info back and forth?
The issue with “Shortcuts” is that there’s more than one type.
Here’s a couple of answers to two possible interpretations…
Custom Shortcuts (Shortcuts App)
Download these example custom shortcuts.
Run Primary and it will pass data to and receive processed data back from Secondary.
Using Donated Siri Shortcuts
Typically you have to work via the clipboard. Apple has not provided another way to deal with this.
However there’s always the chance that if you have a common file store (e.g. Dropbox) and an option to access it, you could pass data via a file rather than the clipboard.
If it helps, using the run shortcut action basically makes them functions and will take the input of the preceding action and pass output to the next.
For example this picture of a shortcut is really two shortcuts put together. The first acts on the input from the share extension, and the passes output into the second which then does something with it.
This allows me to re use these functions without re creating them every time.
I posted something about passingly dictionaries to shortcuts on reddit a while back
How can you add that first action in the second shortcut (set a variable to the input of the script)?
When I select the “Set variable” action my only options for input are clipboard or current date?
A blast from the past that one - I had to download the action to see what it was!
On i*OS13 at least, I do the following:
- In your shortcut’s settings, enable the option to show in share sheet.
- Go into the share sheet types and select ‘deselect all’.
- Come back out to the actions list for your shortcut.
- Tap and hold to get your options list for the parameter you want to set - where you had clipboard, current date, and hopefully now you’ll also have another option…
- Choose select magic variable.
- Scroll to the top of the shortcut and select Shortcut Input as your magic variable and you’re done.
There’s no harm in leaving the accepts in place these days, even if it doesn’t accept anything. It just leaves the shortcut input variable available for selection.
Hope that all makes sense.
DataJar is a good option, imho.
DataJar would work as well.
With help of the app Toolbox Pro you can set global variables, that you can use to get data from one Shortcut to another. Also these variables can be synced between your iOS devices. The free version of this app supports this.
Thanks! Would never have thought of that myself.
Did also not think of DataJar, but I’m going to try that (first?).
I rewrote my script for showing my solar panel production data to read a date from DataJar and created a few new shortcuts that set a date in DataJar and then run this “utility” script:
- date picker
Works great. Thanks again!
This was really helpful for creating another script that:
- Takes a URL as input
- Asks for a name (of a software package)
- Shows a list of actions (like “Investigate”, “Try out”, “Update”, “Download”, “Install”)
- Will add a task to Remember the Milk in the correct list (“Personal”) with the correct tags (“pc”, “now”), location (“Home”) and of course that URL
(I never wrote a script that can be used in the share sheet; your post triggered me to try this)