Hi, I’m trying to save out a JPG to a user-selected folder. I’ve tried a few methods and had it saving successfully to a temp folder. I cannot figure out, though, how to save it to a user-selected folder.
This brings up the dialog for selecting a folder and saves it as a variable:
This doesn’t seem to work however and there is no error in the console due to it being an async function. I suspect it has something to do with userFolder but I have no idea what to try next.
Document#save doesn’t need you to create a session token; it’ll do so on its own. Also, there’s no need to mix await and Promises like you’re doing here. Also, you’re referring to document, but in UXP, document generally refers to the HTML document of the plugin, not Photoshop’s document. Use activeDocument from require("photoshop").app instead.
I don’t think Export As is in the API yet; you could try using Alchemist to see if it’s triggerable via batchPlay.
If not, then you could set your metadata manually first and then save.
There’s been a couple of recent threads regarding metadata that have more detail - it’s not exactly straightforward.