But how can I save the active document. The user loaded it via File Dialog from Photoshop.
How do I get folder of the type folder from the activeDocument?
I dont get any further. So far I have only found examples where I first get a token via a file dialog. Then I can also save with this token.
But how do I get the token when the document is already open? A small code snippet would be very helpful for me.
The long answer:
You need a token to save a file and you can only get one from a file picker invoked via getFolder().
A token provides access to all descendant folders though, so one approach is to get the user to define a root working folder once on plugin installation, generate a Persistent Token for it, and then store that Persistent Token somewhere for later use.
Here’s a demo: