1 Reply Latest reply on Feb 22, 2008 12:00 AM by Martin Fischer

    Groups, deleting items therein

    Level 1
      I have over 1400 groups of 2 objects, a black arrow on top of a white arrow. Instead of keeping things simple, my psychotic client now wants some of the white arrows deleted. I THOUGHT I could write a script to ungroup them and just check .Selection(1) and .Selection(2) for the color and delete the white one. However, as soon as the Ungroup command executes the items are de-selected.

      Then I thought I might be able to work within the group with something like .Selection(1).Groups(1).Item(1).Delete but I can't seem to find anything. When I select a group of two items .Selection(1).Groups.Count returns zero.

      Any help would be appreciated.
        • 1. Re: Groups, deleting items therein
          Martin Fischer Level 2
          Hi Ken,

          in JS you would do it like this:
          <pre>
          var myGroup = app.selection[0];
          var myGroupItems = myGroup.allPageItems;
          for ( var i = 0; i < myGroupItems.length; i++ )
          if (myGroupItems[i].ONEPROPERTY == ONEVALUE )
          myGroupItems[i].remove();
          </pre>

          You can decide to check pageItems or allPageItems of a group at your own.

          Martin Fischer