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

Loop iterates infinitely when trying to work with LayarSets

New Here ,
Jun 06, 2022 Jun 06, 2022

Copy link to clipboard

Copied

I wrote a small script that should display the number of objects inside the group and the name of the groups (only the first nesting level), but the script loops endlessly, who has already encountered this, can you tell me what the problem is?

#target photoshop

var docRef = app.activeDocument;

var myGroups = docRef.layerSets;

alert(myGroups.length);

for( i = 0; i < myGroups.length ; i++) {
    try{
        alert(myGroups[i].name);
        alert(myGroups[i].layers.length);
    }catch(e){}
};

 

TOPICS
Actions and scripting , Windows

Views

110

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
Adobe
Guide ,
Jun 07, 2022 Jun 07, 2022

Copy link to clipboard

Copied

I don't see any problem in this code ¯ \ _ (ツ) _ / ¯

Have you tried it on different documents with different number of groups and always observed this behavior?

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
People's Champ ,
Jun 07, 2022 Jun 07, 2022

Copy link to clipboard

Copied

LATEST

What does endlessly mean? What do the alerts show and how do you run the script? Is this the complete code?

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