Skip navigation
Pop Horia
Currently Being Moderated

Indesign: remove all inline empty frames script?

Mar 18, 2010 4:45 AM

Hi,

 

I need to delete all inline empty frames within a document. Those inline empty frames appear after a data merge is done.

 

Please help!

 
Replies
  • Currently Being Moderated
    Mar 18, 2010 4:53 AM   in reply to Pop Horia
    var doc = app.documents[0]
    var inlines = doc.stories.everyItem().textFrames.everyItem().getElements();
    while(tf=inlines.pop()){
        if(tf.contents==""){tf.remove()}
    }
    

     

    (untested)

    Harbs

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 18, 2010 4:54 AM   in reply to Pop Horia

    Are there any other inline frames?

     

    The code for an inline frame is

     

    Find

    ^a

     

    or

     

    GREP

     

    ~a

     

    If you search for these and replace with nothing, then all inline frames will be removed

     

     

     

    But if you have other inline frames I think you may need a script for that.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 18, 2010 4:58 AM   in reply to Harbs.

    The most excellent Harbs got in before me

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 18, 2010 7:29 AM   in reply to Pop Horia

    Try this:

     

    var doc = app.documents[0]
    var inlines = doc.stories.everyItem().pageItems.everyItem().getElements();
    while(fr=inlines.pop()){
      if(fr instanceof Group){continue}
      if(fr instanceof TextFrame){
        if(fr.contents == ""){fr.remove()}
        continue;
      }
      if(fr.graphics.length==0){fr.remove()}
    }
     
     
    

     

    Harbs

     
    |
    Mark as:
  • Currently Being Moderated
    May 21, 2013 7:07 AM   in reply to Pop Horia

    Im using indesign CS6 and tried the last solution to remove graphics frames after a data merge.

     

    It didn't work. What am I doing wrong? =)

     

    Please help this will save soo much time.

    Thanks.

     
    |
    Mark as:
  • Currently Being Moderated
    May 21, 2013 7:15 AM   in reply to MToys

    Did you get an error message?

     
    |
    Mark as:
  • Currently Being Moderated
    May 21, 2013 7:53 AM   in reply to Peter Spier

    No error message. I tried the delete text frames script and that works.

     
    |
    Mark as:
  • Currently Being Moderated
    May 21, 2013 7:58 AM   in reply to MToys

    I'm not a scripter, so I don't have a lot of good ideas. Maybe Harbs will see this and pop in again.

     

    In the meantime, try making a subfolder in the scripts folder where you saved this and name it Version 7.0 Scripts (this is case sensitive) and see if you get a different result running the script from inside that subfolder.

     
    |
    Mark as:
  • Currently Being Moderated
    May 21, 2013 8:21 AM   in reply to Peter Spier

    Thanks Peter. I tried that but no luck =(

     
    |
    Mark as:
  • Currently Being Moderated
    May 22, 2013 2:07 AM   in reply to Pop Horia

    Hi Pop Horia. Thanks for your reply. The text frame script works fine even when the frames are NOT selected.

     

    I am trying to delete all empty graphics frames. I just tried the script with the frames selected it still didn't work.

     
    |
    Mark as:
  • Currently Being Moderated
    May 22, 2013 2:21 AM   in reply to Pop Horia

    What do you mean by inline?

     

    Like I said the text frame script deletes empty text frames anywhere in the document so this is what I want to do for the graphics frames.

     
    |
    Mark as:
  • Currently Being Moderated
    May 22, 2013 4:07 AM   in reply to MToys

    An "inline" frame is one that is contained inside running text as an anchored object.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (1)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points