2 Replies Latest reply on Apr 29, 2016 2:41 AM by Suzan.V

    Group and Un Group

    Suzan.V Level 1

      Hi all,

       

      i'm trying to do a code can select all objects,text frames and layers then group them all (CTRL+A)+(CTRL+G) then i will add more steps

      after that i want to do UN group again (CTRL+A)+(CTRL+SHIF+G)

       

      i'm trying with this code but i see some layers not selected and not grouped, can someone help please

       

      var doc = app.activeDocument; 

      doc.selectObjectsOnActiveArtboard();    

         

          newGroup = app.activeDocument.groupItems.add(); 

           

          for ( a = app.activeDocument.layers[0].pageItems.length-1; a > 0; a-- ) 

           

          { 

                    app.activeDocument.layers[0].pageItems[a].moveToBeginning(newGroup); 

          } 

       

      Thanks a lot