3 Replies Latest reply on Jul 18, 2008 11:44 AM by (Robert_Tkaczyk)

    ungroup frames

      Hi.
      Can I ungroup the textFrame in my page ?
      I tried using this code below but it isn't work.

      var totalPaginas = myDocument.pages.length;
      for(myCounter = 0; myCounter < totalPaginas; myCounter++){
      var totalGrupos = myDocument.pages[myCounter].groups.length;

      for(myCounter2 = 0; myCounter2 < totalGrupos; myCounter2++){
      var grupo = myDocument.pages[myCounter].groups[myCounter2];
      grupo.unGroup();
      }
      }

      thanks

      Carlos Cubas
        • 1. Re: ungroup frames
          Level 1
          you can't iterate form beginning if you delete items
          you need to iterate backward

          ...
          for(myCounter2 = totalGrupos-1; myCounter2 >0; myCounter2--)
          ...

          or something like this (example in VB):

          do while myPage.Groups.Count>0
          myPage.Groups.Item(1).Remove
          loop

          robin

          --
          www.adobescripts.com
          • 2. Re: ungroup frames
            Level 1
            Hi RObin

            I make a new script and now It's work.

            var totalGrupos = myDocument.pages[myCounter].groups.length;
            while (totalGrupos > 0){
            myDocument.pages[myCounter].groups[0].ungroup();
            totalGrupos--;
            }

            thanks for help me

            Carlos Cubas
            • 3. Re: ungroup frames
              Level 1
              I think you should write it this way:

              while (myDocument.pages[myCounter].groups.length > 0)
              {
              myDocument.pages[myCounter].groups[0].ungroup();
              }

              why ? ;) because one group could be group of two other groups ;)

              group_1 (TextFrame, Rectangle, Oval)
              group_2 (Group_a, Group_b)
              group_3 (TextFrame, TextFrame)

              robin

              --
              www.adobescripts.com