2 Replies Latest reply on Sep 28, 2016 8:36 PM by natrev

    Help Needed on Layer order position

    natrev Level 3

      Hi Everyone,

       

      I have an InDesign document with multiple layers. now I need to rearrange the layer order position based on the layer name

      I have tried but I can't able to rectify the issue.

      Thanks in Advance.

       

      -yajiv

       

                                    Before                                                                                After

      Screen Shot 2016-09-28 at 10.27.53 am.pngScreen Shot 2016-09-28 at 10.54.49 am.png

        • 1. Re: Help Needed on Layer order position
          Obi-wan Kenobi Adobe Community Professional

          Hi,

           

          Here, you could try something like this:

           

          app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.FAST_ENTIRE_SCRIPT, "Sort Layers!");
            
          function main()
          {  
              var myDoc = app.activeDocument;
              for ( l = 0; l < myDoc.layers.length; l++)
              {
                  var myLayerFirst = "Layer 1";
                  var myLayersCounter = myDoc.layers.length - [l];
                  var myLayerNext = "Layer " + myLayersCounter;
                  myDoc.layers.item(myLayerNext).move(LocationOptions.AFTER, myDoc.layers.item(myLayerFirst)); 
              }
          }
          
          
          //          __ (^/) __ 
          

           

           

          (^/) 

          • 2. Re: Help Needed on Layer order position
            natrev Level 3

            Thanks Obi,

             

            Its working...

             

            -yajiv