Copy link to clipboard
Copied
Hi Friends,
How to Add a New Layer As a Last Layer in indesign scripting.
If the Document has 5 layers in the sense,the newly added Layer should be the 6th Layer.
Please Give ideas.
l=doc.layers.add();
l.move(LocationOptions.AT_END); //will move it at the bottom of the layers stack.
Copy link to clipboard
Copied
define "last"?
document.layers.add() will add a new layer at the top;
Copy link to clipboard
Copied
JesRoberts wrote:
.. If the Document has 5 layers in the sense,the newly added Layer should be the 6th Layer.
Please Give ideas.
Adding a layer to a set of five will automatically make this the 6th. I cannot see any other way.
Copy link to clipboard
Copied
No.Actually the index of the new layer will be 0. so it will be first layer of the doc.
My requirement is that the index of the new layer should be index 5.
Copy link to clipboard
Copied
Or How to change the index of the Layers.
Copy link to clipboard
Copied
ok.. i see what you mean. the index of the layer is related with the zOrder.
the topmost layer has the index 0 and the bottom layer has the largest index. also, layes.add() will add a new layer above the currently active layer.
to change the index you have to move the layer. see my previous post
Copy link to clipboard
Copied
l=doc.layers.add();
l.move(LocationOptions.AT_END); //will move it at the bottom of the layers stack.
Copy link to clipboard
Copied
Thank you so much friend:-)
Actually i am new to this scripting.