4 Replies Latest reply on Nov 6, 2012 12:28 PM by Abhi_apple

    Delete Empty Frames in Indesign through AppleScript

    Abhi_apple Level 1

      Hi Everyone,

       

      We have some users who mistakenly add empty frames in the indesign document. (these are generally very small for example {4.9786 in, 3.9402 in} etc)

       

      Can we identify such frames through an apple script.

       

      Usually the frames can be made as a text frame, graphics or unassigned. I am able to delete the empty text frames by using below code:

       

      tell application "InDesign CS4"

      tell page 1 of document 1

      delete every text frame whose contents is ""

      end tell

      end tell

       

      However, not sure how to delete empty graphics or unassigned frames.

       

      Appreciate your help and suggestions!

       

      Thanks,

       

      Abhi

        • 1. Re: Delete Empty Frames in Indesign through AppleScript
          Jump_Over Level 5

          Hi,

           

          I don't know how to "tell" it in applescript, but:

          you should loop in "every splineItem" whose

               fillColor.index == 0 AND

               strokeWidth == 0 AND

               allGraphics.length == 0.

           

          more or less...

           

          Refering to splineItem you refer to "a path-based page item, such as a rectangle, oval, polygon, or graphic line".

           

          hope it can help...

           

          PS. By the way, what about your text frames with NO content but with color or stroke sets?

          For now you are removing them, aren't you?

          • 2. Re: Delete Empty Frames in Indesign through AppleScript
            L. Guy O'Rojo Level 2

            You could check the rectangle for graphic 1 and check the rectangle for its content type. Something like:

             

            tell application "Adobe InDesign CS4"

                      tell document 1

                                tell page 1

                                          tell rectangle 1

              display dialog (content type as text) --> "unassigned" or "graphic type"

                                                    if exists graphic 1 then

                                                              display dialog ("There is a graphic in this rectangle.")

                                                    else

                                                              display dialog ("There is no graphic in this rectangle.")

                                                    end if

                                          end tell

                                end tell

                      end tell

            end tell

            • 3. Re: Delete Empty Frames in Indesign through AppleScript
              Abhi_apple Level 1

              Hi,

               

              Thanks for your note.

               

              I am just doing testing now, so I will need to check it if this works for NO content but with color or stroke sets.

               

              However, I believe it should.

               

              Thanks,

               

              Abhishek

              • 4. Re: Delete Empty Frames in Indesign through AppleScript
                Abhi_apple Level 1

                Thanks for your reply...

                 

                I will check the code..

                 

                Abhishek...