Script with incremental file names

jbperrot Posted messages 10 Status Member -  
 Bal -
Hello,

I’m looking to create a script that finishes by saving the processed image, but that does not overwrite an image file of the same name. A scenario I encounter is running the same script twice in a row on the same image with a save procedure at the end of the script.

Thank you for proposing a solution!!!

Configuration: Windows 7 / Chrome 49.0.2623.112

2 answers

  1. Bal
     
    Hi
    I think you should go through automation file batch processing and at the bottom you should try to choose folder as destination and then serial number instead of file name. (not tested)
    Do not choose save and close as destination because it overwrites the file, instead your script will need a “save as” command at the end.
    0
  2. jbperrot Posted messages 10 Status Member
     
    First of all, thank you for taking the time to respond to me!

    What you give me as a solution would correspond to the case where I have a series of files to which I want to apply the same script and save the modified files in an incremental form like ImageDelta001.jpg; ImageDelta002.jpg; ImageDelta003.jpg;...
    But I have a single file, ImageDelta.psd, to which I apply a script (for example a 5% blur) and I would like each time I run this same script for it to save the file under a name, and if I run the script a second time it saves the modification under another name and not overwrite the file obtained after the first script run...
    I’m not sure I’m clear enough, but please feel free to ask me questions

    See you later
    0
    1. Bal
       
      It's clearer now, I had a doubt. It seems quite complex unless you master JavaScript.
      I think you should ask on the Adobe forums; in any case, it goes beyond my skills, sorry.
      I'm sure it's doable, but I don't know how
      https://forums.adobe.com/community/photoshop/photoshop_scripting
      There might be a possibility to create another script where you would execute the first one twice in the recording of this new script, and so on, but that could quickly become unmanageable in terms of the number of scripts and the file names.
      0
    2. jbperrot Posted messages 10 Status Member
       
      Thank you again for taking the time to respond to me!
      I can see that my issue isn’t simple, but it’s not insurmountable either.
      So I will continue to dig into the subject...
      If I have the solution, I’ll share it in this discussion!
      0
      1. Bal > jbperrot Posted messages 10 Status Member
         
        You might have this solution:
        You run your script, then Ctrl+J to duplicate your layer, and you run the script again on the new layer, and so on with a Ctrl+J before each new script
        And at the very end go to File > Scripts > Export Layers to Files
        You would thus have each layer saved separately in a file in PSD, JPEG, or other format, and they will be saved with an incremented serial number

        The method may have changed slightly on the latest Photoshop versions (CS5 for me)
        https://helpx.adobe.com/fr/photoshop/using/saving-images.html#export_layers_to_files
        0
    3. Bal
       
      It holds up perfectly if you start with only one layer, a Ctrl J takes a fraction of a second.
      If you also assign a keyboard shortcut to your script, it will go very fast.
      Provided, of course, that you don’t have a layer to duplicate 100 times but just 10 or 20 max, otherwise you’d end up with a gigantic PSD and Photoshop would crash.
      There’s nothing better than that, sorry.
      0