Skip to main content
Participating Frequently
February 7, 2020
Answered

"Save As" Action adds "copy"

  • February 7, 2020
  • 2 replies
  • 7694 views

I created an action whereby I save a .psd to a .jpg as follows:

            Go to File “Save As”

            Change from .psd to .jpg

            Choose Save

            Choose Image Options: 12 Maximum

            Choose “OK”

            Close file

 

And the action works fine EXCEPT for one thing, it adds “copy” to the name of the file. 

 

If I do all of the steps in the action MANUALLY the name of the file remains the same with the exception that it changes the extension from .psd to .jpg

 

So to clarify if I am saving an image with a file name of “Black Horse running” and use the action the image file name changes to “Black Horse running copy. jpg”.

 

If I follow the same steps to save the image but do it manually the image file name is “Black Horse running.jpg”.

 

Does anyone have an idea first of all why it’s happening and secondly how can I fix it so the word copy goes away.

 

Any and all advice would be greatly appreciated and thank you for taking the time to respond to me. 

 

Correct answer r-bin
Insert the "flatten image" command and overwrite SaveAs without the "as copy" checkbox turned on. Otherwise, nothing with the use of the Actions, if you want to keep the original file name (without extension).
 

2 replies

JJMack
Community Expert
Community Expert
February 8, 2020

Perhaps this script is what you want. It should save a flat jpeg file over the  jpeg file you opened into Photoshop and  want to save overs after adding layers.  The document open in Photoshop will still be layered after the document has been saved as a flat jpeg file overwriting the opened jpeg file. The script save jpeg quality 10 file. My 79 year old eyes can not see  the differences between quality 10 and 12 and  quality10 file size is much smaller. You can easily change the 10 to 12 in the SaveAsJpeg.jsx file if you want a larger file..

try {
	var tmp = app.activeDocument.fullName.name;
    ftype = decodeURI(tmp.substring(tmp.lastIndexOf("."),)).toLowerCase();
	if (ftype==".nef" || ftype==".cr2" || ftype==".crw" || ftype==".dcs" || ftype==".raf" || ftype==".arw" || ftype==".orf") { throw "error1"; }
	fname = decodeURI(tmp.substring(0, tmp.lastIndexOf(".")));
	SaveAsJPEG(activeDocument.path + "/" + fname, 10);
}
catch(e) {alert("Document has not been save yet")}

function SaveAsJPEG(saveFile, jpegQuality){
	var doc = activeDocument;
	jpgSaveOptions = new JPEGSaveOptions();
	jpgSaveOptions.embedColorProfile = true;
	jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
	jpgSaveOptions.matte = MatteType.NONE;
	jpgSaveOptions.quality = jpegQuality;
	activeDocument.saveAs(File(saveFile+".jpg"), jpgSaveOptions, true,Extension.LOWERCASE);
}
JJMack
jimm7497115
Inspiring
October 23, 2022

this is my first time using scripts on a PC. I tried the script in photoshop, it works great with my original image which I've already saved, it's got layers and a smart object, thank you so much but, when I duplicate that file because I want to save another resized copy it won't work. I get the:

"Document has not been save yet"

error. What do I need to change to be able to save one copy as original size and one copy as a smaller size? I've been using actions to do this but, the 'copy' in the file name drives me nuts, I mean what's the point of an action if it ends up making more work?

Thanks so much.

jimm7497115
Inspiring
October 24, 2022

by the way I see this won't work because I've not saved the duplicate documents. I don't want the documents saved though. I've created a workaround but, I've now got to delete the duplicated documents. I duplicate them because I upload the two jpgs to different websites and it's so much easier to upload the two files if they're appeneded to match the website they're going to. I wish Adobe would let you just save without the 'copy' appeneded from the actions. It doesn't matter if I flatten the image or not, it's maybe because the psd isn't saved, IDK, but, I don't want the copies saved. As I say, the point in the action is to cut work not make more.

JJMack
Community Expert
Community Expert
February 7, 2020

For some reason when you record an action and use Save As and use the File Type pull-down and select Jpeg then click save. You get a pop up dialog stating the file exist do you want to replace it. When you click yes the Files is replaces there is no copy.  However the Action records no file name in the Action step but adds "With Copy". 

When you use the Action. The actions saves a  file named  "DocumentName copy.jpg".   If you do not want the File Name to have that " copy" suffix you have to rename the save file after deleting the existing file without the copy or you can write a Photoshop Script to do the save as jpeg without the copy suffix and use that script in your action in place of the Photoshop step "Save As".  Adobe most likely recorded the action With Copy so the step require user interaction so the action could be batched.  If the file exist the step would need to open the Save As UI pop up Dialog asking it you want to replace the file. When you record the action perhaps if you change the save to folder location you will  not get the With Copy recorded in the action step.    NO that does not work I change the save to folder to the desktop but as soon as I use the file type pull down ans select Jpeg Photoshop checks the Save as Copy option in the save as dialog  and grays it out so you can not remove the With Copy. It is forced on you only get the replace option dialog when  you  are using Photoshop UI.

 

Write the script it will not take many lines of javascript code. 

JJMack
Participating Frequently
February 8, 2020

Hi JJMack . . . thanks for responding so quickly to me.

 

The dialog “file exists do you want to replace it” pops up when you do a “save as” for a .jpg to .jpg.  I’m saving a .psd to a .jpg and that dialog does NOT show up in that process. 

 

On the same screen where you change “save as type” from .psd to .jpg there is a “Save: As a copy” box which you can choose and I believe it will then add “copy” to the file name.  However, I do NOT choose that option.

 

This is what I find very confusing.  Also if it makes a difference I do NOT save in the cloud; I save to a desktop computer.

 

Thanks, ScottishHorseLady