I am trying to capture the layer names from an indesign document. The idea behind the script (when finished) is to create a seperate PDF off each layer in the document and naming that document based on the layer name. My script so far can capture the first and last layer name but I cannot get the layers.nextItem to work. I keep getting an Invalid Parameter.
Please can you advise me on what am doing wrong - Thanks
var myDoc = app.activeDocument;
var myLayers = myDoc.layers.firstItem();
// Box shows first Layer Name
alert (myLayers.name);
for(var i = 0; i < myDoc.layers.length; i++) {
myLayers = myDoc.layers.lastItem();
// Box shows last layer name but I would like the .lastItem to actually work with .nextItem
alert (myLayers.name);
}