Deleting all hidden text frames unexpectedly deletes anchored (but visible) text frames. Why?
I'm trying to use the code below to delete all hidden text frames from a document. It's works pretty well BUT for some reason, deletes visible anchored text frames.
(the currentTextFrame.length argument is to prevent it deleting hidden text frames if the content is threaded, in case the text then reflows into visible text frames. I'll need to work out a solution to that, but it's tomorrows problem.)
I have a similar function for allGraphics and that does not delete anchored frames.
Can someone point me in the right direction? I can add a check to see if the text frame is anchored, but I'm concerned I might miss the bigger problem.
var myDocument = app.activeDocument;
var myTextFrames = myDocument.stories.everyItem().textContainers.reverse();
var myTextFramesLength = myTextFrames.length;
for ( i = 0; i < myTextFramesLength; i++ ){
var currentTextFrame = myTextFrames;
if ((!currentTextFrame.visable) && (currentTextFrame.length ===1)){
currentTextFrame[0].remove();
}
}

Edit: This is happening in CC 2014.0 and 2015.1, OSX 10.10
Message was edited by: Naomi Kennedy