Skip to main content
December 5, 2016
Answered

Selecting an unanchored frame

  • December 5, 2016
  • 1 reply
  • 584 views

Beackground

I have a few old documents (~150) that are having issues. When opening these documents one graphic file cannot be found. I know this file was not checked into our source control system, therefore it's missing.

I can see the name of the missing file, for the moment I skip the dialog and continue.

I don't have the file (since it was not checked in) so I want to delete it from the document and insert a new one.

If I run a LOR/Imported Graphics I see file is located on page 42. If I navigate to that page I don't see the expected gray box to indicate the missing file.

I run the script below and I get that the file is located in an unanchored frame, that I cannot see.

Question:

Is there a way to select either the graphic or the unanchored frame in order to delete it? Thanks for any ideas...

var oDoc, oGraphic, oFrame;

oDoc = app.ActiveDoc;

oGraphic = oDoc.FirstGraphicInDoc;

if(oGraphic.ObjectValid()){

    //good to go

     while (oGraphic.ObjectValid()) {

         //

         if (oGraphic.type == Constants.FO_Inset){

             oFrame = oGraphic.FrameParent;

             alert(oGraphic.InsetFile + "\n" + oFrame.constructor.name);

         }

         oGraphic = oGraphic.NextGraphicInDoc;    

     }

}

This topic has been closed for replies.
Correct answer frameexpert

If you simply want to delete the frame that contains the graphic, you can use:

oFrame.Delete ();

Note that if there is more than one frame that you need to delete, then deleting one of them may end your loop prematurely. If that is the case, you may want to collect all of the frames that need to be deleted in an array, and then loop through the array and delete each frame. If you need help with this, please let me know.

-Rick

1 reply

frameexpert
Community Expert
frameexpertCommunity ExpertCorrect answer
Community Expert
December 5, 2016

If you simply want to delete the frame that contains the graphic, you can use:

oFrame.Delete ();

Note that if there is more than one frame that you need to delete, then deleting one of them may end your loop prematurely. If that is the case, you may want to collect all of the frames that need to be deleted in an array, and then loop through the array and delete each frame. If you need help with this, please let me know.

-Rick

www.frameexpert.com
Legend
December 6, 2016

If you still want to select it, you can do:

oGraphic.GraphicIsSelected = true;

Then I guess you could delete it with:

oDoc.Clear(0);

Russ