Copy link to clipboard
Copied
I have this layers /\ and this script \/
However, when I run...
The length show in alert window should be 2
What is wrong?
your script seems correct, there's a chance "Children 1" and "Children 2" are Groups instead of Layers
Copy link to clipboard
Copied
your script seems correct, there's a chance "Children 1" and "Children 2" are Groups instead of Layers
Copy link to clipboard
Copied
Beat me to it, again! 😉
Copy link to clipboard
Copied
That's it!
In SVG files, they are ever groups?
Copy link to clipboard
Copied
Are you sure those are sub-layers and not groups?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
by a whole minute hehe
Copy link to clipboard
Copied
Hi,
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.
Thanks
Copy link to clipboard
Copied
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..
Copy link to clipboard
Copied
william, also if you need this a lot, you can turn Layer Thumbnails off to quickly tell what's what.
Copy link to clipboard
Copied
Great! This is another something new for me..
Thanks
Copy link to clipboard
Copied
Hi again,
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.
Thanks
Copy link to clipboard
Copied
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. =(
Copy link to clipboard
Copied
Hmm, Thats's right.
May be, we ask this feature request at Illustrator User Voice, different thumnail icons for groups, layers, etc.
Thanks
Copy link to clipboard
Copied
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.
Thanks
Copy link to clipboard
Copied
groups sample
var idoc = app.activeDocument;
var layers = idoc.layers;
var main_layer = layers[0];
var main_groups = main_layer.groupItems;
alert(main_groups.length);