• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Obtain filename of referenced graphic

Community Beginner ,
Apr 17, 2019 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

487

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Apr 17, 2019 Apr 17, 2019

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

Votes

Translate

Translate
Community Expert ,
Apr 17, 2019 Apr 17, 2019

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

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