I've seen a few posts on similar topics, but I'm not sure if they were exactly the same. I am running Mac OS 10.5.8, InDesign CS 4 ver 6. Often our InDesign documents start (from an XML load into a InDesign template) with some empty text frames that we end up manually deleting. I saw the script below on these forums and gave it a try to automate deleting the empty frames - it looks like it should do what I need, but I get this error:
JavaScript Error!
Error Number: 1
Error String: contentType
File: Applications/Adobe InDesign CS4/Scripts/Scrips Panel/RemoveEmptyFrames.jsx
Line: 7
Source: if (myTextFrames[0].contents == "") myTextFrames[0].conentType = ContentType.UNASSIGNED.
Does anyone have advice on how to make this work?
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].remove();
}
if (myTextFrames[0].contents == "") myTextFrames[0].contentType = ContentType.UNASSIGNED;
}