6 Replies Latest reply: Jul 16, 2012 6:27 AM by Brendan Stewart RSS

    Save As -> Settings and Filename Incrementer

    Brendan Stewart Community Member

      Hello All,

       

      I'm on CS5/CS6, i use a panel which i created in configurator. I have it run actions, menu items etc. All works great.

       

      Problem:

       

      I'm sick and tired of saving each open active image as JPG and incrementing the filename by 1.  I'm hoping someone can point out to me on how to increment the filename number by 1, from a panel with a button called say - "Save As Increment"

       

      So to play this out in a real world scenario....

       

      1. Photoshop open.

      2. Image file open and active.

      3. I save the first file with name 'GeorgePortrait01.jpg' by clicking the save as button on my configurator panel and giving it the name manually.

      4. > I want to now work on active/open image #2, when i'm done processing that, i'd like to click on my other button hypothetically called 'Save As Increment' which i just click and in the background it:

           A) Takes my settings specified in the script file for quality etc...

           B) Takes my folder location info also set in the script file

           C) Finds the latest incremented number in the folder and then increments by 1

           D) Saves it as GeorgePortrait02.jpg

       

      So after the script modifications and the first file save, from then on after i'm done with each image, i only have to click the button 'Save As Increment' from that point on until i'm done with the set.

       

      Is this possible? I'd like a vb script solution if possible. Any advice is hugely appreciated.

       

       

      TIA!

        • 1. Re: Save As -> Settings and Filename Incrementer
          Brendan Stewart Community Member

          The reasoning for this is i spend a lot of time giving file names and setting quality settings over and over, on 1000 images or more, it really adds up to some real time.

          • 3. Re: Save As -> Settings and Filename Incrementer
            Muppet Mark Community Member

            You asked for vb which may put off most here… as you are open to altenatives… This I just C&P from Tom's Event Manager Script…

             

            ///////////////////////////////////////////////////////////////////////////////

            // Function: CreateUniqueFileName

            // Usage: given a folder, file name and extenstion create a file with a unique

            //        file name

            // Input: given a folder, file name and extenstion

            // Return: the full path to the unique file

            ///////////////////////////////////////////////////////////////////////////////

            function CreateUniqueFileName( inFolder, inFileName, inExtension ) {

                      var uniqueFileName = inFolder + inFileName + inExtension;

                      var fileNumber = 1;

                      while ( File( uniqueFileName ).exists ) {

                                uniqueFileName = inFolder + inFileName + "_" + fileNumber + inExtension;

                                fileNumber++;

                      }

                      return uniqueFileName;

            }

             

            Simple enough…

            • 4. Re: Save As -> Settings and Filename Incrementer
              Brendan Stewart Community Member

              Hey Mark,

               

              Thank you for posting this, i think i'll be led down the right path. My only question is, how do i pass the proper parameters to it? Will i be prompted, or do i need to define them within the script?

              • 5. Re: Save As -> Settings and Filename Incrementer
                Muppet Mark Community Member

                I posted this just to show the basic principle… It should just keep adding 1 until a file is not found on system… I think it may be easier for you to translate than call Im yet to try configurator so Im unsure what you are doing…

                • 6. Re: Save As -> Settings and Filename Incrementer
                  Brendan Stewart Community Member

                  Mark,

                   

                  I see what you mean. Let me explain, (I'm extremely new to photoshop scripting, not photoshop itself)....

                   

                  1. Now that i have this script, i should be able to call it by name or from an action. I'm assuming this is correct.

                  2. I want to pass the path, filename and extension to this script from the action, or something else, preferably without hardcoding it.

                   

                  How can i do that? Is there something that prompts for empty parameters? Like a dialog box? Or do i need to pass them somehow when calling the script? I don't have PS in front of me at the moment to test it out...

                   

                  I did some searching where people put the parameters in an Environment Variable. (Windows). I think that could be an option for me.... but was hoping there was an easier way.

                   

                  Please advise, thank you!