Here’s the info for the shortcut action.
It notes “Files” as the input to the script, but it does accept text, so you could coerce your dictionary into a JSON format and pass that in. But then you would have to try and pick apart the text to get the elements you want in a usable format.
I tried just passing in a string of comma separated parameters to the action, and using string delimiters to split the string. However, while this works in my script editor, Shortcuts just kept giving me the whole list as one item. That feels pretty buggy, so I would be tempted to try using an osascript
call to a script held outside of Shortcuts that I can test independently.
Expand for the Details
If I run this script in my script editor.
I get …
… followed by …
When I do the same thing, but using Shortcuts to pass the content into the action like this.
I get …
… followed by …
Which seem to be different behaviours given I copied and pasted the core code (just the “on” varies to allow me to test) between the two apps.
As for getting data back, a return
seems to do the job just fine.
I am not sure how accurate the result variable types are as I’m not quite sure how dictionaries would factor in to AppleScript. See my note on lists and object properties being the closest match I can think of to dictionaries in the discussion of episode #86 (third section of the post).