Here is a snippet I've been trying to work with
var myDocument = app.activeDocument;
var myCentreLots = myDocument.textFrames;
this works in part but it seems to have a varied result removing random textboxes over the page...
Is it possible to remove textFrames if not with geometricBounds then within an area of the page say within 20mm from the right edge of the even pages and 20mm of the left edge of the odd pages?
See example.pdf... need to remove left over textFrames from within the green area as a result from a data merge.
You store a reference to all current text frames into your variable myCentreLots. However, as soon as you remove one single frame, that variable is not updated -- making its contents invalid. That's why it appears to remove random frames.
Make the loop go the other way around; if you start at the end and remove a frame (or not), those 'before' it are unaffected:
for(a=myCentreLots.length-1; a >= 0; a--)
It's a common trick to work with references to ID objects.
Thanks [Jongware] that seemed to do the trick.... hadn't seen that reverse loop before..