Copy link to clipboard
Copied
I have a script which deletes graphics but leaves behind anchored frames. Is there any way I can find out which pages of my doc/book has empty anchored frames?
Copy link to clipboard
Copied
You could use something like this:
#target framemaker
var doc = app.ActiveDoc;
var frames = getEmptyAnchoredFrames (doc);
deleteFrames (frames);
function getEmptyAnchoredFrames (doc) {
var graphic, frames = [];
graphic = doc.FirstGraphicInDoc;
while (graphic.ObjectValid () === 1) {
// Test for an anchored frame.
if (graphic.constructor.name === "AFrame") {
// See if the anchored frame is empty.
if (graphic.FirstGraphicInFrame.ObjectValid () === 0) {
frames.push (graphic);
}
}
graphic = graphic.NextGraphicInDoc;
}
return frames;
}
function deleteFrames (frames) {
for (var i = 0; i < frames.length; i += 1) {
frames.Delete ();
}
}
Copy link to clipboard
Copied
Thank you! frameexpert