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();
}
}
}
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
Copy link to clipboard
Copied
what empty text boxes are you talking about? we can't see what you are talking about.
Copy link to clipboard
Copied
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. 🙂
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
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
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)
}
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.