Arguments not passed from Share Sheet


Most probably I am missing something here. When I run the script below from Share Sheet (directly from, not via then I get an empty object in the args.js file

let fm = FileManager.local()
let fo = fm.documentsDirectory()
let fi = "args.js"
let aa = JSON.stringify(args)
fm.writeString(fo+"/"+fi, aa)

For this script I have selected all input types in “Share Sheet Inputs” inside Scriptable (Text, Images, URLs, File URLs) so it is available for most files in the, via Share > Run Script. But it seems that I never get any arguments passed to my script and the args.js always shows an empty object. I was expecting to have something passed into the global args object depending on the type of the input file.


Try out this example and see if you have anything on your clipboard when you run it.

let al = new Alert();
al.message = args.urls.length.toString() + " URLs copied and ready to paste";
await al.present();
return args.urls;

Brilliant - thank you! It seems my problem was with the JSON.stringify() function not parsing the args object correctly. Strangely, JSON.stringify(args.urls) shows everything as expected, but not JSON.stringify(args)