Advertisement


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


Question

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.

2016/08/17
1
1
8/17/2016 10:14:00 PM

Accepted 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);
2015/02/16
2
2/16/2015 10:29:00 PM