3 Replies Latest reply on Sep 27, 2011 9:13 AM by jl2000

    Is there a way to gather all shape layer and all text layers?

    jl2000 Level 1

      Hi -

      I have 250 multi-layered PSD (CS5/Win) files.  Each file shows 2 views of a product.  Parts of the product are labels (Text layers with different words). Then Shape layer arrows point from the label Text to the specific point on the product.

        • 1. Re: Is there a way to gather all shape layer and all text layers?
          jl2000 Level 1

          Sorry - I hit Enter before I was done with my question.

           

          Is there a way to use either an Action or a script to put all the Text layers and Shape layers in a Group named "Labels and Arrows"?   I tried using Actions but there is a different number of Shape layers in each file.  Results were not good.  Same with the Text layers.

           

          I need to be able to gather the layers by their "function" rather than layer name.

           

          TIA any suggestions

           

          jl

          • 2. Re: Is there a way to gather all shape layer and all text layers?
            c.pfaffenbichler Level 9

            Does this help?

            // move text and solid fill layers to newly created folder;
            // 2011, use it at your own risk;
            #target photoshop
            if (app.documents.length > 0) {
                      var myDocument = app.activeDocument;
                      var theSet = myDocument.layerSets.add();
                      theSet.name = "Labels and Arrows";
                      var theLayers = moveLayers(app.activeDocument, theSet);
                      };
            ////// function to move certain layers //////
            function moveLayers (theParent, theSet) {
                      if (!allLayers) {var allLayers = new Array} 
                      else {};
                      for (var m = theParent.layers.length - 1; m >= 0;m--) {
                                var theLayer = theParent.layers[m];
            // apply the function to layersets;
                                if (theLayer.typename == "ArtLayer") {
                                          if (theLayer.kind == "LayerKind.TEXT" || theLayer.kind == "LayerKind.SOLIDFILL") {
                                                    alert (theLayer);
                                                    theLayer.move(theSet, ElementPlacement.PLACEATBEGINNING)
                                                    }
                                          }
                                else {
                                          if (theLayer != theSet) {
                                                    moveLayers(theLayer, theSet)
                                                    }
                                          }
                                };
                      };
            
            • 3. Re: Is there a way to gather all shape layer and all text layers?
              jl2000 Level 1
              c.pfaffenbichler -

              very nice!  thank you.

              jl