5 Replies Latest reply on Oct 17, 2015 4:01 AM by c.pfaffenbichler

    Is it possible to get layer, layerset and layer with in layerset status...!!!

    natrev Level 3

      Hi Everyone!,

       

      Is it possible to get layer, layerset and layer with in layerset status. Since I have faced big problem beyond this.

       

      I have an one PS document which is contain collection of layer, collection layersets with layer. I need apply function for each layer and layersets and all layers with in layerset.

       

      Also I tried one code but its getting error. Please help me to out this code...

       

      -yajiv

       

      #target photoshop

      app.bringToFront();

      $.level=2;

      var docRef = app.activeDocument;

      var log="";

      var x=0;

      var n=Number(docRef.layers.length)-1;

      for (i=0;i<n;i++){

          var tm=String(docRef.layers[i]);

          var isLayer=tm.lastIndexOf("ArtLayer");

          var isLayerSet=tm.lastIndexOf("LayerSet");

          if(isLayer!=-1){

              Check_LayerStructure(docRef.layers[i],"Layer");

          }

          if(isLayerSet!=-1){

              Check_LayerStructure(docRef.layerSets,"LayerSets");

              x=x+1;

              }

      }

       

       

      function Check_LayerStructure(objLayer,objflag,x){       \  

          if(objflag=="Layer"){

              LayetStructure(objLayer,objLayer.name,BlendMode.NORMAL,100,100,0,true," Layer ");

              }

          else if(objflag=="LayerSets"){

              LayetStructure(objLayer[x],objLayer[x].name,BlendMode.PASSTHROUGH,100,100,1,true," Set ");

              m=Number(objLayer[x].layers.length)

            

              for (j=0;j<m;j++){

                  var tm=String(objLayer[x].layers[j]);

                  var isLayer=tm.lastIndexOf("ArtLayer");

                  var isLayerSet=tm.lastIndexOf("LayerSet");

                  if(isLayer!=-1){

                      Check_LayerStructure(objLayer[x].layers[j],"Layer");

                  }

                  if(isLayerSet!=-1){

                      Check_LayerStructure(objLayer[x].layerSets,"LayerSets",x);

                      }

          } // Layerset Loop

      }// I For Loop

      }//Function loop

       

       

      function LayetStructure(layerRef,L,bMode,Opt,fillOpt,S,layVisible,Lref){

          if(layerRef.blendMode!=bMode){

                if (confirm (L + Lref+"belend mode was wrong...!!!\n"+"Do you want to change....?")){

                    layerRef.blendMode=bMode;

                    log=log+"- " +L+ Lref+ "belend mode was changed...!!!\n\n";

                    e=1;

                  }      

              }

       

       

         if(layerRef.opacity!=Opt) {

                if (confirm (L + Lref+ "Opacity was "+Math.round(layerRef.opacity)+"%...!!!\n"+"Do you want to change....?")){

                    layerRef.opacity=Opt;

                   log=log+"- " + L + Lref+ "Opacity was changed to 100...!!!\n\n";

                    e=1;

                  }      

             }

       

            if(layerRef.fillOpacity!=fillOpt && S==0) {

                if (confirm (L + Lref+ "Fill was "+Math.round(layerRef.fillOpacity)+"%...!!!\n"+"Do you want to change....?")){

                    layerRef.fillOpacity=fillOpt;

                    log=log+"- " + L + Lref+ "Fill was changed to 100...!!!\n\n";

                    e=1;

                  }      

             }

       

          if(layerRef.visible!=layVisible) {

                if (L + Lref+ "eye was off..!!!\n"+"Do you want to change....?"){

                    layerRef.visible=layVisible;

                    log=log+"- " + L + Lref+ "eye was turn into on...!!!\n\n";

                    e=1;

                  }      

             }

        }