I have a number of utility Shortcuts that are run from other Shortcuts.
I wanted to change the input parameter for a number of these (from a text list to a dictionary) and needed a list of all the Shortcuts that run a specific utility Shortcut so I could make the change everywhere it was required.
I managed to put together a Shortcut to create this list and thought I’d share it here in case others found it useful.
The Shortcut performs the following…
- Retrieves a list of shortcuts in your library
- Presents this as a list to allow you to pick the “called” shortcut
- Loops through all the Shortcuts in your library to see if they call the chosen shortcut
- Displays the list of calling shortcuts
The tricky piece was detecting if a Shortcut calls the chosen Shortcut. The way it does this is as follows…
- Renames the retrieved Shortcut details as a plist to gain access to its XML representation
- Uses a regular expression to search this XML for called Shortcuts
- Checks if these match the chosen Shortcut
One word of warning, the Shortcut seems to work fine when run from the Shortcuts grid display, but can cause the Shortcuts app to crash when run from the individual Shortcut editor.
I have something similar but my use case is that I wanted to view where I can see which shortcuts are called by a shortcut recursively.
That’s neat !
The call tree view looks very useful.
Just a note for anyone downloading your shortcut that you need to open it in the shortcuts editor and enable access to notifications and files from the relevant actions before it will run successfully.
I’m wondering if @adamtow could teach LaunchCuts to do this.
This is a task better suited for a dedicated app that can easily and quickly parse through plist files. It’s possible to do from a shortcut, as we have seen from all of our example shortcuts, but it’s much faster in a native app.
Don’t know if LaunchCuts is the right app for it, but it’s an interesting app for a developer tool as a sort of shortcut analyzer.
I agree it’s likely to be faster in an app. I happen to think that - as you’re positioning LaunchCuts as a “Swiss Army Knife” - LaunchCuts is a good place for it. Perhaps as a Premium function.
If someone was to make a Shortcuts analyser type thing some sort of share sheet would be quite nice too
My share sheets get far too cluttered. Especially seeing as text accepting shortcuts show up in safari