Copy link to clipboard
Copied
I trying to set up code at the beginning of my script that will look and see if there is a text frame in the document (it will have text in it but I'm not sure if its relevant), and if it exists delete it.
Does anyone have an idea if this can be done?
Thanks,
~David
1 Correct answer
app.activeDocument.textFrames.everyItem().remove();
(^/)
Copy link to clipboard
Copied
Hi,
Try this code.
var myDoc = app.activeDocument;
var myStories = app.activeDocument.stories.everyItem().getElements();
for (i = myStories.length - 1; i >= 0; i--){
var myTextFrames = myStories.textContainers;
for (j = myTextFrames.length - 1; j >= 0; j--){
myTextFrames
}
}
Prabu
Design smarter, faster, and bolder with InDesign scripting.
Copy link to clipboard
Copied
app.activeDocument.textFrames.everyItem().remove();
(^/)
Copy link to clipboard
Copied
These both worked well, thank you so much!

