Monday, May 22, 2017

layers - How to reference a sublayer by name in an Illustrator script?



How can one reference a sublayer in functions like setLayerVisibility, that accept layer names as arguments?


I tried


setLayerVisibility("MyLayerName.MySublayerName", true)

, but that was ineffective.



Answer



the function may not be set up to look for sublayers, even if you pass the correct sublayer name. If it is, you can do something like...


var myLayer = app.activeDocument.layers["myLayerName"];
var mySublayer = myLayer.layers["mySublayerName"];


alert(mySublayer.name);

No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...