How to check if an anchored frame is empty or not?

New Here ,
Sep 08, 2017

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?

TOPICS
Scripting

Views

233

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

1 Correct Answer

Adobe Community Professional , Sep 10, 2017
frameexpert Adobe Community Professional , Sep 10, 2017
You could use something like this:#target framemakervar 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) {       ...

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
Sep 10, 2017

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 ();

    }

}

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
varuns44789478 AUTHOR LATEST
New Here ,
Sep 12, 2017

Copy link to clipboard

Copied

Thank you! frameexpert

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more