6 Replies Latest reply on May 1, 2012 2:40 PM by hilukasz

    loop through all layers and sublayers

    hilukasz Level 1

      is there a way that I can loop through all layers and sublayers looking for a name of a layer? I have one that loops through only top level layers. I am thinking I have to somehow incorperate all pathItems, groupItems and the like to incorperate all types of "layers" there might be, since a group is technically not a layer but a groupItem.


      this is what I am doing so far:


      for (var i = 0; i < numberOfLayers; i++) { 
          var customName = "div structure";
          var myLayer = app.activeDocument.layers[i];
          var myLayer = myLayer.name;
          //alert (myLayer);
          if (customName == myLayer) {
              alert("layer matches");
          else { break; } 


      any ideas?