• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Script to read layers not working as expected (?)

Community Beginner ,
May 06, 2020 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?

TOPICS
Scripting

Views

1.7K

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
community guidelines

correct answers 1 Correct answer

Community Expert , May 06, 2020 May 06, 2020

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

Votes

Translate

Translate
Adobe
Community Expert ,
May 06, 2020 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

Votes

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
community guidelines
Valorous Hero ,
May 06, 2020 May 06, 2020

Copy link to clipboard

Copied

Beat me to it, again! 😉

Votes

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
community guidelines
Community Beginner ,
May 06, 2020 May 06, 2020

Copy link to clipboard

Copied

That's it! 

 

In SVG files, they are ever groups?

Votes

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
community guidelines
Valorous Hero ,
May 06, 2020 May 06, 2020

Copy link to clipboard

Copied

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

Votes

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
community guidelines
Community Beginner ,
May 06, 2020 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

Votes

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
community guidelines
Community Expert ,
May 06, 2020 May 06, 2020

Copy link to clipboard

Copied

by a whole minute hehe

Votes

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
community guidelines
Community Expert ,
May 06, 2020 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

Votes

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
community guidelines
Community Expert ,
May 08, 2020 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..

Votes

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
community guidelines
Community Expert ,
May 08, 2020 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

Votes

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
community guidelines
Community Expert ,
May 08, 2020 May 08, 2020

Copy link to clipboard

Copied

Great! This is another something new for me..

 

Thanks

Best regards

Votes

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
community guidelines
Community Expert ,
May 11, 2020 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

Votes

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
community guidelines
Community Expert ,
May 11, 2020 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. =(

Votes

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
community guidelines
Community Expert ,
May 11, 2020 May 11, 2020

Copy link to clipboard

Copied

LATEST

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

Votes

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
community guidelines
Community Expert ,
May 08, 2020 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

Votes

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
community guidelines
Community Expert ,
May 06, 2020 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);

Votes

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
community guidelines