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

How to create the group in the script

Participant ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

How to create the group in the script

is taken naming is Garments folder layers

example 3 layers

  • Red
  • Blue
  • Green

Screen Shot 2017-08-03 at 3.45.42 PM.png

I needed Art group inside

3 group folders

  • Red
  • Blue
  • Green

Screen Shot 2017-08-03 at 3.48.49 PM.png

TOPICS
Actions and scripting

Views

3.0K

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

Engaged , Aug 03, 2017 Aug 03, 2017

Hi Saranraj,

Try this..

var docRef=app.activeDocument;

var LsetGarmants=docRef.layerSets.getByName("Garments");

var LsetART=docRef.layerSets.getByName("ART");

var len=LsetGarmants.layers.length;

if(len>0){

    for(var i=0; i<len;i++){

        if(LsetGarmants.layers.typename=="LayerSet") continue;

        flg=LsetART.layerSets.add();

        flg.name=LsetGarmants.layers.name;

    }

}

-yajiv

Votes

Translate

Translate
Adobe
Engaged ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

Hi Saranraj,

Try this..

var docRef=app.activeDocument;

var LsetGarmants=docRef.layerSets.getByName("Garments");

var LsetART=docRef.layerSets.getByName("ART");

var len=LsetGarmants.layers.length;

if(len>0){

    for(var i=0; i<len;i++){

        if(LsetGarmants.layers.typename=="LayerSet") continue;

        flg=LsetART.layerSets.add();

        flg.name=LsetGarmants.layers.name;

    }

}

-yajiv

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
Participant ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

thank you very much it's working

layers

  • Red
  • Blue
  • Green

Group

  • Green
  • Blue
  • Red

the group folder align change

it's possible the same align layer

Screen Shot 2017-08-03 at 6.10.49 PM 1.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
Engaged ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

Hi Saranraj,

Try this one. If its working please mark as correct answer.

var docRef=app.activeDocument;

var LsetGarmants=docRef.layerSets.getByName("Garments");

var LsetART=docRef.layerSets.getByName("ART");

var len=LsetGarmants.layers.length;

if(len>0){

    for(var i=len-1; i>0;i--){

        if(LsetGarmants.layers.typename=="LayerSet") continue;

        flg=LsetART.layerSets.add();

        flg.name=LsetGarmants.layers.name;

    }

}

- yajiv

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
Participant ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

this coding Run one folder is missing

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 ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

LATEST

natrev​s code is close

With a few changes

var docRef=app.activeDocument;

var LsetGarmants=docRef.layerSets.getByName("Garments");

var len=LsetGarmants.layers.length;

var LsetART=docRef.layerSets.getByName("Art");

if (len>0 && LsetART.layers.length == 0) {

    for (var i=len-1; i>=0; i--) {

        if (LsetGarmants.layers.kind != LayerKind.NORMAL) {continue};

        flg=LsetART.layerSets.add();

        flg.name=LsetGarmants.layers.name;

    }

} else { alert ("wrong structure"); }

Have fun

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