Copy link to clipboard
Copied
Hi all,
I'm trying to learn InDesign JavaScripting and I want to run a script in each active document to add two new layers to the bottom of the document.
I've surfed the internet but I can't find anything that makes sense to me, any help would be much appreciated.
This is what I have so far, this is saved as a .js file in my scripts folder;
var myDoc = app.activeDocument.Layer.add({name:"EPub"});
app.activeDocument.Layer.add({name:"TOC"});
It runs and the following error appears, what am I doing wrong?
app.activeDocument.layers.add({name:"EPub"});
app.activeDocument.layers.add({name:"TOC"});
To move the layers to the bottom, use the move command, like so:
main();
function main() {
var doc = app.activeDocument;
var layerEPub = doc.layers.add({name:"EPub"});
layerEPub.move(LocationOptions.AT_END);
var layerTOC = doc.layers.add({name:"TOC"});
layerTOC.move(LocationOptions.AT_END);
}
Copy link to clipboard
Copied
app.activeDocument.layers.add({name:"EPub"});
app.activeDocument.layers.add({name:"TOC"});
Copy link to clipboard
Copied
To move the layers to the bottom, use the move command, like so:
main();
function main() {
var doc = app.activeDocument;
var layerEPub = doc.layers.add({name:"EPub"});
layerEPub.move(LocationOptions.AT_END);
var layerTOC = doc.layers.add({name:"TOC"});
layerTOC.move(LocationOptions.AT_END);
}
Copy link to clipboard
Copied
Thank you