I lifted this code from another discussion that purports to say it works, but it doesn't.
I keep getting the Error: Object does not support the property or method 'length'
I've looked at other batch process scripts that that line of code seems to be correct.
I know this is a very simple script, and that the turn on/turn off layer part of the script works perfectly fine (on individuall pages), but for some reason I can't get it to batch process.
I have a multi-version set of files with layers such as "de" for germany, "us" for United States, etc. that I need to batch turn on so that I can print.
Here is what I have:
var myFolder = Folder.selectDialog("Select Indesign Folder");
var myIndsnFiles = myFolder.getFiles("*.indd");
for(k=0; k<myIndsnFiles.length; k++)
{
var myIndsnFiles = app.open(myIndsnFiles[k]);
var myIndsnFiles = app.documents[0];
var answersLayer = myIndsnFiles.layers.item("us");
answersLayer.visible = false;
app.activeDocument.close(SaveOptions.yes);
}
Can you fix/explain what I'm doing wrong?