Is it possible to select a folder in with DocumentPicker.open()
I would like to process all all the text files I have in one app (I currently do this in Pythonista using the External Files feature, then using the bookmark as the path) to get all the files.
Thanks, looking forward to seeing Scriptable grow.
Yes! This is possible.
let dirs = await DocumentPicker.open(["public.folder"])
let dir = dirs
DocumentPicker.open() accepts an array of Uniform Type Identifiers that it should allow to be opened. To UTI for folders is “public.folder”. By default the document picker supports opening everything but folders so it’s necessary to specify a UTI when opening folders.
That’s great stuff. Thanks for the swift reply.
In order to replicate what I do in Pythonista, there is one further step. That is to be able to bookmark the picked folder.
In Pythonista after I have selected the folder once, I can refer to it on subsequent runs (and restarts of app) without user interaction to pick it again. Is there a way I can bookmark the result (which I could then save to a file for subsequent runs)?
Thank you again for a cool app and your fast reply,
This is not yet supported but it’s something I’m looking into. There’s one limitation of iOS that’s holding me back from releasing this.
Unfortunately, iOS doesn’t allow saved bookmarks to a folder to be accessed in app extensions, e.g. Siri and action extensioned opened from the share sheet. So scripts that depend on a bookmark will only work inside the app.
Would that be similar to using the Always Run In App option (when needing more memory).
I’m enjoying Scriptable fro text processing, but really would love bookmarks to make the scripts streamlined.
Thanks for a cute app,
Yep, that would be similar. I haven’t looked much into this bookmark feature yet but I keep coming back it it. I think it could be a powerful addition, even if it only works inside the app.
I’ve just noticed that this feature is now implemented. That is super exciting.
I’ve just tried it out and it works perfectly.
Thank you. .