Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

loop through layers setting lock and visibility

$
0
0

  I need to loop through the layers in the active document and set some of the layer properties to either false or true.  I was trying to a create a loop using a "for" method, but it didn't seem to work. I gave up on the "for" method because I kept running into a problem.  I don't need to set all layers with these settings just the odd ones (2,4,6, etc). Here is sample if it was written out. 

 

var myLayer = myDoc.layers[2];

myLayer.visible = false;

myLayer.locked = true;

 

var myLayer = myDoc.layers[4];

myLayer.visible = false;

myLayer.locked = true;

 

var myLayer = myDoc.layers[6];

myLayer.visible = false;

myLayer.locked = true;

 

var myLayer = myDoc.layers[8];

myLayer.visible = false;

myLayer.locked = true;

 

I have 208 layers, so doing it this way would be way to long. Any help would be appreciated.

Running Illustrator CC 2014.


Viewing all articles
Browse latest Browse all 12845

Trending Articles



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