• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Action Overwrites JPEG file after the first copy

Community Beginner ,
Jan 03, 2021 Jan 03, 2021

Copy link to clipboard

Copied

Hello, I have been searching for the answer to this for a while now. Even though there is threads already on the same subject I don't see the exact solution or if it is even possible to do what I want. 

 

image.png

 

Here is the current Action that I have set up. This action will not overwrite the file called "Untitled-1.jpg" but will instead make a copy and name it "Untitled-1 copy.jpg". 

 

However, when I go to run the action again, it will now overwrite "Untitled-1 copy.jpg"

 

The reason this is a problem is I sometimes need to save multiple versions of a photo, each with very small changes. So I will run the action, erase a detail or two, then run the action again for the second copy. 

 

Is there a way to not overwrite the file named copy but instead each time make a new file no matter how many times I run the action?

Views

418

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 Expert ,
Jan 03, 2021 Jan 03, 2021

Copy link to clipboard

Copied

If you want to save numbered copies that sounds like a task for a Script. 

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 Expert ,
Jan 03, 2021 Jan 03, 2021

Copy link to clipboard

Copied

If you look at the File > Automate > Batch command, there is an option to override action save as names, as this is a common issue when batch processing saves from an action.

 

You are not using a batch process, so another way around the issue is needed.

 

As c.pfaffenbichler notes, a script would be required to work around the action naming overwriting.

 

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 Expert ,
Jan 03, 2021 Jan 03, 2021

Copy link to clipboard

Copied

Here is a script for this task (not my code):

 

A filename suffix will be added, such as:

 

_001.jpg 

_002.jpg 

etc.

 

EDIT: I just wrapped the original code posting into a try+catch for an open/saved doc and removed the original try/catch for a saved file.

 

 

/* Start Open/Saved Document Error Check - Part A: Try */
savedDoc();
function savedDoc() {
  try {
    app.activeDocument.path;
/* Finish Open/Saved Document Error Check - Part A: Try */

/* Main Code Start */
// https://forums.adobe.com/message/4453915#4453915
main();
function main(){
if(!documents.length) return;
var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');
var savePath = activeDocument.path;
var fileList= savePath.getFiles(Name +"*.jpg").sort().reverse();
var Suffix = 0;
if(fileList.length){
    Suffix = Number(fileList[0].name.replace(/\.[^\.]+$/, '').match(/\d+$/));
}
Suffix = zeroPad(Suffix + 1, 3);
var saveFile = File(savePath + "/" + Name + "_" + Suffix + ".jpg");
SaveJPEG(saveFile, 12);
}
function SaveJPEG(saveFile, jpegQuality){
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = jpegQuality; 
activeDocument.saveAs(saveFile, jpgSaveOptions, true,Extension.LOWERCASE);
}
function zeroPad(n, s) { 
   n = n.toString(); 
   while (n.length < s)  n = '0' + n; 
   return n; 
}
/* Main Code Finish */
}

/* Start Open/Saved Document Error Check - Part B: Catch */
  catch (err) {
    alert("An image must be open and saved before running this script!");
  }
}
/* Finish Open/Saved Document Error Check - Part B: Catch */

 

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

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 Expert ,
Jan 03, 2021 Jan 03, 2021

Copy link to clipboard

Copied

Another option is to record the Image Processor Pro script into an action. When configured similar to below, each use of the action will produce a new saved file with an incremented filename suffix:

 

IPP.png

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
New Here ,
Nov 16, 2022 Nov 16, 2022

Copy link to clipboard

Copied

LATEST

Action work around so files are not overwritten:

NOTE: If you duplicate a layer or file PS will name it "Untitled-1", "Untitled-2" etc. as long as all the files stay open and have not yet been saved. These "untitled..." files can then be Batch Processed without being overwritten. 

This will work for selecting parts of a layer, rotating selections, changing out images (layers) that need to be replaced for a new file, when creating multiple "individualized" gif animations, etc. I use this work around a lot.

This example: Changing the color of this leaf with an overlay. Overlays in PS file are on blank layers. 

Image 1: PS screen before action was run. Note action is repeated for each of the 3 color overlays. 

KJSmallBiz-Batch-1.jpg

 Image 2: PS screen AFTER action was run: Note there are now 4 open files and Nothing has been saved yet - the next step: Close your master /original psd file.  Then Batch Save the open "untitled" files. KJSmallBiz-Batch-2.jpg

 Action:

KJSmallBiz-Action-Batch.png

 

Hope this helps, let me know if you need more details, KJ

 

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