Accessing all the layers in all the layer sets
Hi Everyone,
I am writing a script that searches through all the layers and changes labels and names based on blend mode, layer types, etc.
I can get all the layers not in sets into an array and act upon them.
I can get all the layersets into an array. ( I want to put layersets in an array so I can do things like count them, search, them, rename later)
I can't figure out how to drill down into the layersets so I can get the contained layers pushed into the layer array.
I thought it might be something like this, but this doesn't work.
var layerSetArray = [ ];
// how I got the layers:
for(var i = 0; i < doc.artLayers.length; i++)
//how I got the layersets:
var layerSetName = doc.layerSets[i].toString();
layerSetArray.push(layerSetName)
}
//what I can't figure out: (doesn't work)
for( var i = doc.layerSetArray.length; 0 < i; i++){
var nestedLayer = layerSetArray[i].artLayers.name
layerSetArray.push(nestedLayer)
}
Any suggestions would be greatly appreciated.
Thanks for reading!
