r/shortcuts•
Azgymb

Running shortcut from shortcut passing values

TIP/GUIDE

A shortcut only has the magic variable "Shortcut Input" if it is available via share sheet. Now maybe you want to use a shortcut as subroutine and receive arguments. But the shortcut is not meant to be seen in share sheet or widget. To get access to the "Shortcut Input" make it visible in share sheet. Use the action "Get Variable" and select "Shortcut Input". Now remove the the shortcut from share sheet. The action will stay and the shortcut will accept the input other shortcuts pass into it.

Posted Sep 21, 2018, 9:44 PM UTC

45
phchecker17•

Can confirm this works! Needs to be higher up as PSA, as I was actually wondering if that is possible.

Allows for a lot more complex shortcuts than without, as you can as well outsource smaller subroutines, which you couldn‘t before!

2
SwaysInYourMind•

Can you please do a Screen record of what it does ? I don't understand it and I think it might be helpful.

1
AzgymbOP•

Many use it to create menus. In the video you can see that I check the price for a meal in the university's canteen. When I tap ok, the shortcut runs itself again. As that shortcut might be a bit complicated to understand, I created an example that adds up the number 1 to 5. Import the example, tap on the three dots to edit and then tap the play icon. Shortcuts nicely visualizes how the shortcut calls itself and how the calls return at the end. At the bottom you will see the result.

Video: https://imgur.com/a/Fq1trgi

Example: https://www.icloud.com/shortcuts/95034e95334f425d821c01287e80d8b6

2
imguralbumbot•

^(Hi, I'm a bot for linking direct images of albums with only 1 image)

https://i.imgur.com/HT4hIJZ.mp4

^^Source ^^| ^^Why? ^^| ^^Creator ^^| ^^ignoreme ^^| ^^deletthis

1
SwaysInYourMind•

Oooh ok ! I already knew about this trick; thanks anyway for sharing :)

1