your script seems correct, there's a chance "Children 1" and "Children 2" are Groups instead of Layers
Beat me to it, again! 😉
In SVG files, they are ever groups?
Are you sure those are sub-layers and not groups?
No... I'm not sure.
If that's true, I should treat then like group or "convert" then to layers?
It's a SVG file
by a whole minute hehe
Children 1 and Children 2 are not layers. You can check by blue color left to the layer name. When we create a layer, by default each layer have different color inless and untill you make it as same color.
ooooooh i feel so stupid. i've been using the appearance panel to tell the difference between layers and groups.. I never considered the color coding..
william, also if you need this a lot, you can turn Layer Thumbnails off to quickly tell what's what.
Great! This is another something new for me..
This only works unless and untill someone does not makes same color for layer(which hardly someone changes layer color). But @carlos new way is also a good one.
I just saw one more options in Layer Panel Options , i.e. "Show Layers Only".
This can also be used to identify layers, but yes it will not give difference between layers and group all together.
i used this one briefly as well.. but it turns out that having access to the groups in the layers panel is very important to my workflow. it would be nice if there were just some kind of small unobtrusive icon indicating which is which. =(
Hmm, Thats's right.
May be, we ask this feature request at Illustrator User Voice, different thumnail icons for groups, layers, etc.
var idoc = app.activeDocument; var layers = idoc.layers; var main_layer = layers; var main_groups = main_layer.groupItems; alert(main_groups.length);