Skip to main content
BEGINNER_X
Legend
May 5, 2015
Answered

Ungroup, again group

  • May 5, 2015
  • 1 reply
  • 710 views

Hi All,

My Request,

1. Select the groups(consists of two page items with create outlines)

2. Ungroup the selection

3. apply transparency

app.selection[0].transparencySettings.dropShadowSettings.size = 10;

4. Again group

Could you please provide your help.

Regards

Siraj

This topic has been closed for replies.
Correct answer Vamitul

You don't really need to ungroup.

//asssuming myGroup is the group you need:

myGroup.pageItems[0].transparencySettings.dropShadowSettings.size = 10;

myGroup.pageItems[1].transparencySettings.dropShadowSettings.size = 10;

1 reply

Vamitul
VamitulCorrect answer
Legend
May 5, 2015

You don't really need to ungroup.

//asssuming myGroup is the group you need:

myGroup.pageItems[0].transparencySettings.dropShadowSettings.size = 10;

myGroup.pageItems[1].transparencySettings.dropShadowSettings.size = 10;

BEGINNER_X
Legend
May 5, 2015

Hi Vamit,

Thank you for the fast reply,

for another scenario, I am trying Seleted item should be ungroup and group.

I look at forum, but not works for me.

orggroup = app.activeDocument.groups[0].allPageItems; 
app.activeDocument.groups[0].ungroup(); 
newgroup = []; 
for (i=0; i<orggroup.length; i++) 
  newgroup.push(orggroup);
app.activeDocument.groups.add(newgroup); 

Thanks in advance

Daniel Sterchi
Inspiring
May 6, 2015

Hi Beginner_X

I tested the code. It works, but it does not group and ungroup the selected Item. I just wrote a few lines more. So if you really have to ungroup and group again, give my code a try.

kind regards

Daniel (from Switzerland)

main();

exit();

function main() {

    var orgGroup;

    // test if the seleted item is a Group

    if ((app.selection.length > 0) && (app.selection[0].constructor.name  == "Group")) {

        alert("Info\nGroup selected");

        orgGroup = app.activeDocument.groups[0].allPageItems;

        app.activeDocument.groups[0].ungroup();

      

        alert("Info\nUngrouped the selected group");

      

        // call your function(s)

        yourStuff();

    }

    else {

        alert("Warning\nNo group selected");

        orgGroup = "";

    }

    if  (orgGroup != "") {

        newgroup = [];

        for (i=0; i<orgGroup.length; i++) newgroup.push(orgGroup);

      

        app.activeDocument.groups.add(newgroup);

        alert("Info\nRegrouped previous grouped Items");

    }

    alert("Info\nI did my job, what about yours?");

}

function yourStuff() {

    alert ("Info\nDo your stuff here");

}