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.

1 Answer 1


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"];

  • ”may not be set up […]” Well, yes, this script works indeed! It does alert the correct sublayer name.
    – Ideogram
    Dec 16, 2017 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.