Quantcast
Channel: Adobe Community: Message List - InDesign Scripting
Viewing all articles
Browse latest Browse all 37788

Re: Script for InDesign CS6 - create multiple, prenamed layers

$
0
0

Marijan Tompa's scripts are very nice and useful, however, for this simple task you can try create your own wiht this code:

 

app.activeDocument.layers.add ({name: "GRADIENT", layerColor: UIColors.red});
app.activeDocument.layers.add ({name: "STRIPES", layerColor: UIColors.lightBlue});
app.activeDocument.layers.add ({name: "LEGAL", layerColor: UIColors.gray}); //merge existing document layer to bottom layer (in this case original layer will be merged to 'GRADIENT')
var myDocument = app.documents.item(0);
var myLayerA = myDocument.layers.item(2);          var myLayerB = myDocument.layers.item(3);          myLayerA.merge(myLayerB); 
alert("Layers created!");

 

assume, your document has one layer.

Script creates three new layers, they appear in Scripts palette in this order:

LEGAL

STRIPES

GRADIENT

and merges 'old' layer to bottom layer of newly created set (GRADIENT).

sure, you can add as much layers as you need, just don't forget modify LayerA and LayerB numbers accordingly.

Or disable second part of the script at all, if you don't want anything to be merged.


Viewing all articles
Browse latest Browse all 37788

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>