4 Replies Latest reply on May 6, 2015 8:35 AM by BEGINNER_X

    Ungroup, again group

    BEGINNER_X Level 3

      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

        • 1. Re: Ungroup, again group
          Vamitul Level 4

          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;

          • 2. Re: Ungroup, again group
            BEGINNER_X Level 3

            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[i]);
            app.activeDocument.groups.add(newgroup); 

             

            Thanks in advance

            • 3. Re: Ungroup, again group
              Daniel Sterchi Adobe Community Professional

              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[i]);
                     
                      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");
              }
              
              • 4. Re: Ungroup, again group
                BEGINNER_X Level 3

                Dear Vamitul & Dani,

                 

                Sorry for the late response...

                Apologies., for that, I confused two questions in the same thread.

                 

                Vamit: your coding is working fine. Thank You for your immediate response. Again thanks a ton.

                 

                Dani: Thanks for your valuable timing spend for me.

                I will test your code and get back in separate thread.

                 

                Warm Regards

                Siraj