1 Reply Latest reply on Dec 4, 2012 2:25 PM by [Jongware]

    Merge multi layers

    Simon Dav Level 1

      Hi all,

       

      I am using Indesign 5.5 ver 7.5.3. when i am merging the layers of multiples, its not working more than 2 layers, how can i merge more than 2 or multiple layers

       

      can any one help me!

       

      here the script:

       

      main();

      function main(){

                mySetup();

                mySnippet();

      }

      function mySetup(){

                var myDocument = app.documents.add();

                myDocument.layers.add();

      }

      function mySnippet(){

          var myDocument = app.documents.item(0);

                var myLayerA = myDocument.layers.item(0);

                var myLayerB = myDocument.layers.item(1);

                myLayerA.merge(myLayerB);

      }

       

      thanks

      simon

        • 1. Re: Merge multi layers
          [Jongware] Most Valuable Participant

          By issuing more 'merge' commands, one per additional layer:

           

          function mySnippet(){
            var myDocument = app.documents.item(0);
            while (myDocument.layers.length > 1) // still more than 1 layer
            {
              var myLayerA = myDocument.layers.item(0);
              var myLayerB = myDocument.layers.item(1);
              myLayerA.merge(myLayerB);
            }
          }