Saving psd document without update photoshop document

I’m struggling with an issue when I try to save the activeDocument to a temporary file.

Let’s say I’m with a PSD file opened in my photoshop, and this PSD is stored at the normal user file system (not a temporary folder), but I need to upload this actual document (PSD) to an API so I’m calling the activeDocument.save(tempFile) to save this document to a tempFolder so I can upload this document without asking for user permissions.

This works as expected, I can do the upload, but I noticed that when I go to photoshop and click to reveal the active document in Explorer, then Photoshop shows that the active document is the file I previously saved when I did activeDocument.save(tempFile).

There is anyway I can avoid this behavior or there is another to accomplish my goal (upload the active document without user permission)? I think this can break the flow of a designer, because this temporary folder and its content will be deleted.

You could duplicate document into new window. The duplicate has no fileReference. And close it once you are done. Or you could try a luck with “save as a copy” flag.

Right, I’m new into uxp plugins, I’m working in my first one.

This “save as a copy” flag I know it was available in CEP extensions by passing an extra argument, but following the docs of uxp I didn’t find anything related to it, I also didn’t find anything related to duplicate the document into a new window. How can I duplicate my current document?

1 Like

Thanks so much!

This helped me a lot :slight_smile: