Obtain filename of referenced graphic

Community Beginner ,
Apr 17, 2019

Copy link to clipboard

Copied

I am trying to create a script that I can run individually on referenced graphics which would return me information on what file it is, and which document it is located in.

So far I have this script

var graphic = null;

var doc = app.ActiveDoc;

if(doc.ObjectValid() == true)

{

       graphic = doc.FirstSelectedGraphicInDoc;

      

       if(graphic.constructor.name != "Inset")

        {

            graphic = null;

            alert("inset not found");

        }

}

if(graphic != null && graphic.ObjectValid() == true)

{

    var promptMessage = "The currently-selected graphic is:\n\n" +

       graphic.Name +"\n\n" + doc.Name;

        alert(promptMessage);

    }

else

{

    alert("No active document or no referenced graphic selected. " +

        "Cannot continue.");

}

alert("script complete!");

Right now when I have a graphic selected it produces the alert which correctly tells me what document the file is in but says "undefined" in the space I expect to see the image filename.

What is the correct way to obtain this information?

TOPICS
Scripting

Views

401

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 , Apr 17, 2019
frameexpert Adobe Community Professional , Apr 17, 2019
The property you want on an imported graphic is not Name but InsetFile.

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
Apr 17, 2019

Copy link to clipboard

Copied

The property you want on an imported graphic is not Name but InsetFile.

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