5 Replies Latest reply on Sep 14, 2012 2:19 PM by Michael L Hale

    Modify Load Files into Stack.jsx

    kkocinski

      I am new to Photoshop Scripting so I am sorry if this has already been answered, but I can't seem to find out the answer or figure this one out.   I am writing a script that is doing an INCLUDE using the Photoshop script Load Files into Stack.jsx.  This script seems to name the layers the Filename.  I would like to figure out how to modify this script to not include the file name in the layer and just put Layer 1, Layer 2.  Any help would be greatly appreciated. 

        • 1. Re: Modify Load Files into Stack.jsx
          JJMack Most Valuable Participant

          If you do not know scripting well that may be hard to do. When I look at that script and the "Stack Scripts Only" scripts they were way over my head

          scripting wise. If your code includes that script the it may be simpler just to let it do its thing then loop thought the layers and rename the layers in the loop.

          • 2. Re: Modify Load Files into Stack.jsx
            kkocinski Level 1

            That may work, but I am not sure what to put into the script and where (sorry, yes I am new at this, this is my first attempt and Photoshop scripts).  Here is what I am doing and what I have coded so far.  I have created a droplet that would move files over into Photoshop do some reformating of the images and then when I get 4 images into Photoshop I am merging the open documents into a separt document and then kicking it back over to an action to do some more formatting with the combined document.  Here is the code I have so far. 

             

            var loadLayersFromScript = true;
            //@includepath "/C/Program Files/Adobe/Adobe Photoshop CS5.1 (64 Bit)/Presets/Scripts/"
            //@include "Load Files into Stack.jsx"
            var files = [];
            // declare local variables for close files
            var name = activeDocument.name;

            for(var d =0;d<app.documents.length;d++){
                try{
                    files.push(app.documents[d].fullName.fsName);
                }catch(e){
                    alert(localize('$$$/AdobePlugin/Exposuremerge/Mustsave=Documents must be saved before they can be merged'));
                }
            }
            if( d > 3 ){
            loadLayers.intoStack(files,true);

            // close documents except Untitled document
            while (documents.length > 1) {
              for (var i = 0; i < documents.length; i++) {
            // close all documents except the active document
              if  (documents[i].name != "Untitled1") {
                          documents[i].close(SaveOptions.DONOTSAVECHANGES);
                        }
              }
            }

            doAction("Resize Canvas", "Finish Document");
            }

            The reason I need the Layers to not be names is because the document names change and I can not get the actions to work with the differences in the Layer Names when the new files come in. 

             

            Any help would be GREATLY appreciated.   

            • 3. Re: Modify Load Files into Stack.jsx
              JJMack Most Valuable Participant

              If the sctript works for you perhaps all you need to do is to record your action a little differently and not use layer names at all just select the bottom leyer using the relative select botton later the select the othe three layer reltive to that. The shortcut keysy are Alt|Option+, bottom layer Alt|Option+] layer forward, There is also  Alt|Option+. top Layer and Alt|Option+[ layer backwards.

              • 4. Re: Modify Load Files into Stack.jsx
                kkocinski Level 1

                JJMack - with your suggestion I was able to get the script to work.  Thank you for the great Idea.  Sometimes it just takes stepping back for a minute to see another solution.  Thanks again!

                • 5. Re: Modify Load Files into Stack.jsx
                  Michael L Hale Level 5

                  Load Files into Stack uses several other support scripts and those support scripts are used by other scripts. The layer name is set in one of those support scripts and I really think it would be a bad idea to make any changes.

                   

                  I think it would be better( and much eaiser ) just to rename the layers after the stack is completed.

                   

                  var numberOfArtLayers = app.activeDocument.layers.length;
                  for(var l = 0; l<numberOfArtLayers;l++){
                      app.activeDocument.artLayers[l].name = 'layer '+l;
                  }