2 Replies Latest reply on May 16, 2017 1:44 PM by carlosn21996940

    How to move layer to top layer

    carlosn21996940

      This should be really easy but for some reason, it just isn't working for me.

       

      I'm using a script to create a document. It does a bunch of stuff include adding a layer. Where I am stuck is that at the end I need the original layer to be moved to the top. I know this is possible because if I just open InDesign and drag layer 2 below layer 1 in the layers panel I get the result I want.

       

      This is the code I am using

       

      myDocument.layers.item(1).move( myDocument, ElementPlacement.PLACEATBEGINNING );

       

      I know that I am referencing the correct layer because I added myDocument.layers[1].name="test" and the layer I want to move to the top changes to "test" in the layers panel.

       

      I have been googling this for a few hours and looked at every relevant question about this and no luck.

       

      Can someone tell me what I am doing wrong?