Skip to main content
Inspiring
January 29, 2024
Answered

remove copy when I duplicate document

  • January 29, 2024
  • 2 replies
  • 1643 views

there is a way to
remove copy when I duplicate document?

 

This topic has been closed for replies.
Correct answer Davide_Barranca12040269

@DavideBarranca , please forgive another intrusion; could you chime in on short/efficient UXP-code for this task? 


Hi @c.pfaffenbichler,

I'd do it like this:

 

 

const { app, core } = require("photoshop");
await core.executeAsModal( async () => {
  app.activeDocument.duplicate(app.activeDocument.name, true);
}, { commandName: "Duplicate with the same name" });

 

 

Which seems exactly what @Ciccillotto is using 👌
The boolean is for merged layers, like in ExtendScript, BTW.

 

 

2 replies

Chuck Uebele
Community Expert
Community Expert
January 29, 2024

In the preferences, under file handling, check the box that says: "Do not append 'copy' to filename when saving a copy."

Inspiring
January 29, 2024

I didn't explain myself well when I duplicate the document the word copy comes out.

Davide_Barranca12040269
Legend
January 31, 2024

@DavideBarranca I was wondering if there is a way to call back via uxp button a psjs file, I tried a couple of ways but it doesn't work, you have faced this problem.


@Ciccillotto I don't think so, but you can try to batchPlay the File > Script > Browse... and point to a `file:`, but be aware that there are manifest permissions to set, unless the file is in the plugin's sandbox. Adobe did something to restrict that Browse... call for JSX, IIRC, so it may or may not work (can't test now)

Davide Barranca - PS developer and authorwww.ps-scripting.com
Ged_Traynor
Community Expert
Community Expert
January 29, 2024

@Ciccillotto you can do that from the layers panel flyout menu, if that's what you mean.