Hi! I honestly don’t understand why some basic and necessary functions don’t work when using batchPlay, like replacing content or inserting an image to the document.
Is there any other way to make this work? Thanks
_path needs to be a token and not the actual path. Check this example for createSessionToken(entry). And you won’t be able to access just any file on the system just like that, without a file picker. And most likely you will have to put your runScript_04() into executeAsModal()
Without file picker you can access only 3 folders:
All methods described on same docs page.
For file picker you can define the initial location (also see docs) where it will open. Also, when you get the file once, you can generate persistent token and access that file any time later without file picker. Or you can get persistent token to a folder by using getFolder() and then access all files in it recursively without a picker
Hi @Karmalakas I’m just a beginner in UXP, to be honest I’m completely lost in using these methods, unfortunately I couldn’t follow your tips, could you show me a practical example using one of these methods so that I can better understand what you did you try to explain? Thanks for sharing
@PS-fxrios here’s a repo of a plugin I made to demonstrate using persistent tokens (and storing them for later use) to save a file using batchPlay. Whilst it’s not specifically your use case it has most of the ingredients.
Hi @Timothy_Bennett , thanks for sharing your plugin, it will be very useful. It won’t be easy, but I’ll study and try to understand each line and how to make something so necessary for my workflow work.
We don’t have a lot of informations about it yet. So for example readFile returns an ArrayBuffer. Not sure how we can get a file object that we then can use for creating a token.
Statement from Vinay from the UXP team:
Currently there is no way to get a token from the file after reading using the FileSystem APIs, Provision for this is planned.
FileSystem APIs are to provide unrestricted access, which isn’t currently available with UXP FileSystemProvider without File Picker