Highlighted

Removing empty textboxes

New Here ,
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();
}
}
}

Adobe Community Professional
Correct answer by JonathanArias | Adobe Community Professional

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

 

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

Views

141

Likes

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

Removing empty textboxes

New Here ,
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();
}
}
}

Adobe Community Professional
Correct answer by JonathanArias | Adobe Community Professional

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

 

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

Views

142

Likes

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
Jul 07, 2020 0
Adobe Community Professional ,
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.

Likes

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
Reply
Loading...
Jul 07, 2020 0
New Here ,
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. 🙂

Likes

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
Reply
Loading...
Jul 07, 2020 0
Adobe Community Professional ,
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

 

Likes

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
Reply
Loading...
Jul 07, 2020 0
Advocate ,
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

Likes

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
Reply
Loading...
Jul 07, 2020 0
Adobe Community Professional ,
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)
}

 

 

 

Likes

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
Reply
Loading...
Jul 07, 2020 1
Explorer ,
Jul 07, 2020

Copy link to clipboard

Copied

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. 

Likes

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
Reply
Loading...
Jul 07, 2020 0