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?
The property you want on an imported graphic is not Name but InsetFile.
Copy link to clipboard
Copied
The property you want on an imported graphic is not Name but InsetFile.