Highlighted

Script to read layers not working as expected (?)

Community Beginner ,
May 06, 2020

Copy link to clipboard

Copied

Herikle_0-1588780151859.png

I have this layers /\ and this script \/

Herikle_1-1588780178160.png

However, when I run...

Herikle_2-1588780241149.png

The length show in alert window should be 2

 

What is wrong?

Adobe Community Professional
Correct answer by CarlosCanto | Adobe Community Professional

your script seems correct, there's a chance "Children 1" and "Children 2" are Groups instead of Layers

Topics

Scripting

Views

1.3K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Script to read layers not working as expected (?)

Community Beginner ,
May 06, 2020

Copy link to clipboard

Copied

Herikle_0-1588780151859.png

I have this layers /\ and this script \/

Herikle_1-1588780178160.png

However, when I run...

Herikle_2-1588780241149.png

The length show in alert window should be 2

 

What is wrong?

Adobe Community Professional
Correct answer by CarlosCanto | Adobe Community Professional

your script seems correct, there's a chance "Children 1" and "Children 2" are Groups instead of Layers

Topics

Scripting

Views

1.3K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
May 06, 2020

Copy link to clipboard

Copied

your script seems correct, there's a chance "Children 1" and "Children 2" are Groups instead of Layers

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 06, 2020

Copy link to clipboard

Copied

Beat me to it, again! 😉

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Community Beginner ,
May 06, 2020

Copy link to clipboard

Copied

That's it! 

 

In SVG files, they are ever groups?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 06, 2020

Copy link to clipboard

Copied

Are you sure those are sub-layers and not groups?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Community Beginner ,
May 06, 2020

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 06, 2020

Copy link to clipboard

Copied

by a whole minute hehe

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 06, 2020

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

Best regards

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 08, 2020

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..

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 08, 2020

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.

hideLayerIcons.PNG

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 08, 2020

Copy link to clipboard

Copied

Great! This is another something new for me..

 

Thanks

Best regards

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 08, 2020

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

Best regards

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 11, 2020

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

Best regards

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 11, 2020

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. =(

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 11, 2020

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

Best regards

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 06, 2020

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);

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...