Action or Script to automate saving PNGs without appending "copy" to the filename.

Community Beginner ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

I want to create an action to save PNGs to a folder on my desktop without the suffix "copy" being added. I know that with the new release of Photoshop 22.4.2, a check box in prefferences has been added to create the abilitty to ommit "copy" from being added ("Do not append "copy" to filename when saving" in Prefferences/File Handling). It works great when I am just saving out one png file. However, I can't get it to work in an action without brining up a dialogue box. If I have to hit the enter button for each file, the time I would have saved from the action is lost.

 

Adobe, is there a way to write an action without the dialogue box?

 

Has anyone writen a script I could run instead of an action in the meantime? Again, I just want to save a png from a psd to a folder called "PNG" on my desktop without "copy" being added to the end of the name.

TOPICS
Actions and scripting

Views

1.0K

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Jun 14, 2021 Jun 14, 2021
(aD = activeDocument).saveAs(File('~/desktop/PNG/' + aD.name), new PNGSaveOptions, true)

Likes

Translate

Translate
Adobe Community Professional ,
Aug 24, 2021 Aug 24, 2021

Copy link to clipboard

Copied

Really? That shouldn't have any impact. Why you even thought to change that?

Anyway I posted the code to do the same for jpg (and just tested to say it works).

 

If you won't have a problem with, please mark an answer in original thread as correct solution (so that will be easier for other users with similar saving issue to recognise it as helpful topic):

das Wort "kopie" tauch immer noch auf wenn ich die Dateien durch aktion als JPG speichere

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

This should do it...

 

 

#target photoshop;

function SavePng(Folder) {

    /* FileToSave = 
     * the Folder parameter
     * + the name of the document without extension
     * + png
     * 
     * This will break if there is no "." in the document's name (ie: if the document was not saved beforehand)
     */
    var FileToSave = new File(Folder+app.activeDocument.name.match(/(.*)\.[^\.]+$/)[1]+".png"); 

    SaveOptions = new PNGSaveOptions();
    SaveOptions.interlaced = true; 
    activeDocument.saveAs(FileToSave, SaveOptions, true, Extension.LOWERCASE);
}

/*Call the function using the folder where you want to save your png files, replace YOURUSERNAME with your user name. ;-)*/
SavePng("C:/Users/YOURUSERNAME/Desktop/PNG/");

 

 

edit: use the one from Kukurykus, it's a lot better.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

Thank you so much for putting time into helping out on this! I really appriciate it!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

When I think of PNG file format I think of Apple,  Web Browser format, Supports Transparency and Photoshop Export save for web has more png options then  Photoshop "Save As" and Photoshop DOM Scripting PNGSaveOptions.  The ScriptListener Action Manager Code for both PNG8 and PMG24 are huge and unreadable with my knowledge of Acrion Manager code.  I also notices several of the Photoshop Scripts Adobe install with Photoshop support saving PNG8 and PNG24  files  using Action Manager Code where the scripts save the other Images file  using Scripting DOM code.   The Action Manger code used for PNG8 and PNG24 is not as many lines as the Scriptlistener records for Save for Web so I reused Adobe action manger code in my script.  In front of Adobe's Action Manager code for save for web Adobe has a ScriptUI Dialog the user uses to set some of the PNG8 and PNG24 save options.  My script has no dialog the settings must be passed to the SaveAsPNG function Though I saw embed ICC profile and a Trim check boxes in Adobe Dialog  for png8 and png24 I did not see them used  in Adobe Saved for web action manager code.    So my function SaveAsPNG has just four parms (File, PNG8|PNG24, Interlace, Transparency). I believe the DOM Doc.saveAs png is a PNG24 filetype.

JJMack

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

Thanks for putting time into your respnses JJMack. It's appriciated!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines