Scriptable and Shortcuts

Short question: Can I transfer a scriptable variable to shortcuts and run the shortcut? If yes, how?

Thanks.

Yes. You could pass it via the clipboard, a file in an area both apps can access (check out file bookmarks in Scriptable) or as a URL encoded parameter in a URL scheme call to run the shortcut.

2 Likes

Great, I could send json parameter from scriptable and receiving it with callback function in shortcut.

2 questions:
Can I create a JSON file in Scriptable AND store this directly in my Shortcut iCloud-folder (not in scriptable iCloud-folder)?

Can I trigger in scriptable to run a shortcut FROM a widget ? I can run it directly via scriptable app, but I have a weather widget, which fetches weather data and update the weather data in the widget. I also added code to run the shortcut (which should update my phone’s wallpaper depending on the weather condition). Shortcut is not running in widget-mode, but if I run the widget script directly in scriptable app, it is working. Any work around?

Yes - again, see file bookmarks in Scriptable.

I don’t think you can start chaining app calls together so much for a widget, but I don’t actually use any home screen widgets currently, so it isn’t something I’ve explored. I’m sure someone else will have explored this by now and can confirm your results or offer an alternative approach that would work.

However, worst case scenario,I would imagine that a workaround could be an automation that runs on a schedule and calls your shortcut that processes the currently available JSON. Tends to be tedious to set-up the automations, but it is certainly possible. i.e both the Scriptable widget and the Shortcuts automation/shortcut run on independent schedules, not even loosely coupled, but they share access to the file.

1 Like

Great. JSON stored with bookmarks in shortcuts folder. Shortcut to set my wallpaper runs faster. :+1:t3:

I am still hesitating to apply the workaround.

Is there a trigger I can use once I unlock my device to run a shortcut?

Not on my iPhone. You could use a schedule as I suggested previously or introduce a manual trigger such as a home screen shortcut, back tap, dock on charger, etc.