Two important pieces of information about any imported graphic are :
The file name is just a string while the DPI is an integer. To display it in the console, requires that it be converted to a string.
Here is the output from a file with just one imported graphic:
Adding the code line graphic.InsetDpi = 2400; within the loop, resets the image's DPI making it smaller. The console now shows:
NOTE: The console does not get cleared between successive runs of your script. Closing it clears the content.
- The full pathname of the imported file.
- The DPI at which the file was imported.
The file name is just a string while the DPI is an integer. To display it in the console, requires that it be converted to a string.
var doc= app.ActiveDoc;
ListGraphics (doc);
function ListGraphics(doc)
{
var graphic = doc.FirstGraphicInDoc;
while (graphic) {
if (graphic.type == Constants.FO_Inset) {
Err(graphic.InsetFile);
Err(" ");
Err(graphic.InsetDpi + "");
Err("\n");
}
graphic = graphic.NextGraphicInDoc;
}
}
function ListGraphics(doc)
{
var graphic = doc.FirstGraphicInDoc;
while (graphic) {
if (graphic.type == Constants.FO_Inset) {
Err(graphic.InsetFile);
Err(" ");
Err(graphic.InsetDpi + "");
Err("\n");
}
graphic = graphic.NextGraphicInDoc;
}
}
Here is the output from a file with just one imported graphic:
Adding the code line graphic.InsetDpi = 2400; within the loop, resets the image's DPI making it smaller. The console now shows:
NOTE: The console does not get cleared between successive runs of your script. Closing it clears the content.
There is also the undocumented Console() function. The only difference I can see is that Console returns Console() while Err() returns undefined...
ReplyDelete