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

ungroup all groups on an active layer(JavaScript).

Explorer ,
Mar 05, 2013 Mar 05, 2013

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

TOPICS
Scripting
47.1K
Translate
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

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

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

Translate
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

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.

Translate
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

look here, I made an "ungroup" function

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

Translate
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

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

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

Translate
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