How to understand what Scriptable receives from Shortcuts as urls?

For debugging I’d like to see what was passed from Shortcut to Scriptable under arg.urls parameter.

So I

  • created simple Sciptable script that sets incoming args.urls into local variable and returns that variable back to Shortcuts;
  • tried to put any type of data into URLs fields in Shortcuts.

After that in Shortcuts debug window I see only empy array - ["","",""] with the same size as the quantity of URLs passed to Scriptable. What’s wrong? May be this is the right behaviour?

Can you share your example shortcut and Scriptable code?

And Scriptable:
let container = args.urls;
return container

By the way I found ready script “What Is Shared?” in Scriptable gallery. It shows the same result, empty URLs whatever I set in URLs fields in Shortcuts.

Do remember to post links wherever possible, and to place code in code blocks.

Here’s a test shortcut I created. It passes in two URLs to the Scriptable script. One defined as a Shortcuts URL, and one defined directly in plain text.

I named my Scriptable script URL Arg Test.

let al = new Alert();
al.message = "Received " + args.urls.length + " URLs\n" + args.urls.join("\n") + "--- end ---";
await al.present();
return args.urls;

Note that I’m treating args.urls as an array, not a single element variable.

When I run it I get the following:

image

This indicates that two URLs were indeed received, but Scriptable has not picked up the values of those URLs.

If I set the Scriptable script to be visible for sharing URLs to, and then share from a web page however, the URL value that is passed in is picked up. It is exactly the same as the second URL passed from the Shortcuts test.

I think this tells us that Scriptable is receiving the data into the script in both cases (ref. the count of URLs), but while from the share sheet the values are accessible, when received from the Shortcuts action step, they are not.

@simonbs - is this an issue you are aware of?


  • Scriptable Version: 1.6.3 (177)
  • iPadOS Version: 14.4

@sylumer, many thanks for your explanation!

I wasn’t aware of this issue but will investigate :male_detective:‍♂

1 Like