I’m trying to process the contents of a file passed in to a Shortcut via the sharesheet. The attached screen shot is the Content Graph as the first step of the Shortcut (ie, the input).
I’m simply trying to get to the info in the “data” object (3rd level of my series of screenshots)
Despite my attempts… can’t figure out how to get to the file contents. Ultimately…trying to get to the XML data to create a dictionary for subsequent processing.
Am I overlooking the action(s) needed to get to the file contents? Thanks, as always, for any tips…
Not sure if you meant to include some other screenshots given the reference above, but perhaps you could share a copy of the file being passed in to the shortcut so we could get a better idea about what you are working with?
I am curious to learn how to do what I describe above, but… I’ve since realized the file I’m trying to process is not in a format that I will be able to convert to a dictionary. So… my question is no longer relevant, at least for this use case.
Here is an example file
But, again… I’m on a fools errand in terms of my overall Shortcut idea, so no need to spend time on this one! Scriptable may be a better path for me.
I suspect that the trick you need is to make Shortcuts think the input is actually just a text file like this:
In order to convert the XML to a dictionary, the path of least resistance is to probably convert the XML to JSON and the use a Get Dictionary from Input action on that. Unless you can use an external web service to do that, then a judicious use of find replace (perhaps the odd regular expression to speed things up) would set you up and you would be off.
Hope that helps.
Thanks @sylumer… that was just the action sequence I needed. Always learning!
Now, on to the more challenging work. As always… thanks for your insights and tips. Cheers! — jay