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

ungroup all groups on an active layer(JavaScript).

Explorer ,
Mar 05, 2013 Mar 05, 2013

Copy link to clipboard

Copied

Does anyone know how one would go about ungrouping all groups on an active layer with JavaScript?

TOPICS
Scripting

Views

44.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 , Mar 07, 2013 Mar 07, 2013

you're looking for "Recursion", check this thread, Mark has a sample of how to recurse layers and groups.

http://forums.adobe.com/message/3387938#3387938

Votes

Translate

Translate
Adobe
Community Expert ,
Mar 05, 2013 Mar 05, 2013

Copy link to clipboard

Copied

there are no group or ungroup commands, to group you create a groupItem Object and move stuff inside it. To ungroup, you take stuff out of the group (move them out).

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
Explorer ,
Mar 07, 2013 Mar 07, 2013

Copy link to clipboard

Copied

bummer.

Thanks for the info.

Could anyone give an example of moving pageItems out of a group of the active layer?

I know how to get the value of all the group Items in an active layer but I do not know the proper syntax to use to pull the page items out of it.

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 ,
Mar 07, 2013 Mar 07, 2013

Copy link to clipboard

Copied

look here, I made an "ungroup" function

http://forums.adobe.com/message/3842344#3842344

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
Explorer ,
Mar 07, 2013 Mar 07, 2013

Copy link to clipboard

Copied

Awesome! I have more than one group on the layer and by adding a For loop to get the value of all groups I was able to use your example to get those groups out of there.

var myLayer = app.activeDocument.activeLayer;

var group = thisDoc.activeLayer.groupItems;

for (d=0;d<group.length;d++){

    var mygroups = group;

          for (i=mygroups.pageItems.length-1; i>=0; i--)

               mygroups.pageItems.move(myLayer, ElementPlacement.PLACEATBEGINNING);

     }

Unfortunately I will have groups within groups from time to time. Do you know a way to make the script check for groups on the active layer over and over till there are no more groups? It escapes me.

Thanks for your help,

Duane

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 ,
Mar 07, 2013 Mar 07, 2013

Copy link to clipboard

Copied

LATEST

you're looking for "Recursion", check this thread, Mark has a sample of how to recurse layers and groups.

http://forums.adobe.com/message/3387938#3387938

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