1 Reply Latest reply on Jun 18, 2014 4:43 AM by Laubender

    Empty Graphic Frames

    banl_05 Level 1

      Hi Friends

       

      I try to delete empty graphic frames. So i use the below code

       

      function EmptyGraphicFrame(){

          var myGraphicFrames = app.activeDocument.rectangles;

         

          for (i=myGraphicFrames.length-1; i>=0; i--) {

              var color = myGraphicFrames[i].fillColor.name; 

              myGraphicFrames[i].select;

              if (myGraphicFrames[i].graphics.length < 1 &&  color == "None" )

             {

                myGraphicFrames[i].remove();

             }

         }

      }

       

      But the above code delete table present in graphic frame (graphics.length return 0)

       

      Thanks

      Balaji

        • 1. Re: Empty Graphic Frames
          Laubender Adobe Community Professional & MVP

          @Balaji – if "something" is nested inside of your rectangle, use the allPageItems array of that rectangle to detect this:

           

          //Rectangle selected:
          var myRectangle = app.selection[0];
          var allInRectangle = myRectangle.allPageItems;
          alert(allInRectangle.length);
          

           

          A table is not part of a graphic.

          It's part of a text frame or sits nested in a table cell.

           

          Uwe