Selecting an unanchored frame

New Here ,
Dec 05, 2016

Copy link to clipboard

Copied

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;    

     }

}

TOPICS
Scripting

Views

293

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 , Dec 05, 2016
frameexpert Adobe Community Professional , Dec 05, 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

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
Dec 05, 2016

Copy link to clipboard

Copied

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

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
Mentor ,
Dec 06, 2016

Copy link to clipboard

Copied

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

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
funsekon AUTHOR LATEST
New Here ,
Dec 06, 2016

Copy link to clipboard

Copied

Thanks Rick, that seemed to solve the issue.

@Russ Ward, I tried your suggestion but for some reason it the unanchored frame does not display on screen. So I decided to just delete it (with my eyes closed).

Have a great days and thanks for chiming back.

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