• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Removing empty textboxes

New Here ,
Jul 07, 2020 Jul 07, 2020

Copy link to clipboard

Copied

Please help me making my work more efficient.

 

For my work i have to create display cards with text and prices. Therefore i use data merging, but after data merging there are more than 100 pages.

 

I would love to know if theres a simple step to remove empty text boxes, because not every display card needs a blue textbox, only the ones that are filled with text.

 

And does someone knows how to automaticaly create the right wright of these boxes after of among data merging?

 

Thanks so much. I will upload some pictures so u can see what i mean.

 

Kind regards

**Update

Thank you all for your help and answers! I used this script and this works excellent 🙂

var myStories = app.activeDocument.stories.everyItem().getElements();
for (i = myStories.length - 1; i >= 0; i--){
var myTextFrames = myStories[i].textContainers;
for (j = myTextFrames.length - 1; j >= 0; j--) {
if ((myTextFrames[j].contents == "") || (myTextFrames[j].words.length == 0)){
myTextFrames[j].remove();
}
}
}

TOPICS
How to , Import and export , InCopy workflow , Performance , Scripting

Views

2.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guru , Jul 07, 2020 Jul 07, 2020

i see, ok, those fields are empty because there was no data to pull copy from.

 

i have this happen all of the time. they don't display when you make a .pdf of an image so for me i dont' think this is a big deal.

 

have you looked at this?:

https://indesignsecrets.com/finding-empty-text-frames-in-indesign.php

 

Votes

Translate

Translate
Guru ,
Jul 07, 2020 Jul 07, 2020

Copy link to clipboard

Copied

what empty text boxes are you talking about? we can't see what you are talking about.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 07, 2020 Jul 07, 2020

Copy link to clipboard

Copied

Schermafbeelding 2020-07-07 om 16.51.53.png

 

When there is no tekst in the blue boxes, i would like to remove them with one easy step. And not on each page removing them by hand. 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jul 07, 2020 Jul 07, 2020

Copy link to clipboard

Copied

i see, ok, those fields are empty because there was no data to pull copy from.

 

i have this happen all of the time. they don't display when you make a .pdf of an image so for me i dont' think this is a big deal.

 

have you looked at this?:

https://indesignsecrets.com/finding-empty-text-frames-in-indesign.php

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 07, 2020 Jul 07, 2020

Copy link to clipboard

Copied

There is a few script that do that. Take a look at this one:
https://redokun.com/resources/delete-empty-text-frames-script

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 07, 2020 Jul 07, 2020

Copy link to clipboard

Copied

Here's a short jsx script that should do the trick. Edit: Or what Jean-Claude said, which I missed! My snippet would miss frames with returns, spaces, etc. 

 

 

 

var tfs = app.activeDocuments.textFrames;
var numTfs = tfs.length - 1;
for (var i = numTfs; i >= 0; i--) {
   try {
      if (!tfs[i].contents || tfs[i].contents == "") { tfs[i].remove(); }
   } catch(e)
}

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 07, 2020 Jul 07, 2020

Copy link to clipboard

Copied

LATEST

I'm always hestitant to remove elements from a standardized layout. I'd be more inclined here to have two object styles for your blue box: 1 with fill, 1 with no fill. Then the script would find any object "Blue Fill" that contains no text, and apply object style "No Fill". A similar script could find any "No Fill" object that does contain text and apply the "Blue Fill" object style. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines