Opening a file fromicloud

Hi. I am an experienced programmer but new to scriptable… apologies if this question is obvious.
I want to search an ia.writer file line by line and just list the lines containing a certain term. I have it working if I open the file and run the script from the share tab… if you run it from outside ia.writer I have it so it prompts for a file using the document picker. What I really want is to always search the same file regardless of where the script is run. I got a path from documentpicker and tried using that. It worked fine in scriptable but running the script elsewhere doesn’t work. I am sure I could do what I want using bookmarks, but then I can only run from scriptable again according to the documentation. So in short how do I hard code an iCloud path and file name into a scriptable script.

You can’t. When a file is shared, not only the file path is returned, but also the receiving app is allowed access to it from iOS. If you save that path and try it again after some time, it won’t work anymore. This is a restriction from iOS and I’m glad that it exists, otherwise every app could read all your data on your device.

This is your only choice if this file is outside of the Scriptable directory.

And please use paragraph breaks. It makes reading a lot easier :wink:

Oh well. I can see what you mean about security. I suppose it makes sense. I can get it close enough to what I want so all good.

Thanks for your help.