I am intermediate with Javascript, but am not so familiar with Adobe's "Extendscript". For practice and a better understanding of InDesign's code structure, I am trying to access properties of an image via rectangles.images
.
Is this possible to access say, the file name of an image, through rectangles.images
? Also I am interested if it's possible to access the image's color attributes this way, say to convert it to greyscale?
Here is my approach so far:
for(var i = 0; i < app.activeDocument.rectangles.length; i++)
{
var imageType = app.activeDocument.rectangles[i].images.constructor.name;
switch(imageType)
{
case "Images":
alert(app.activeDocument.rectangles[i].images.name); // "name" is not a valid property here!
break;
default:
alert("There are no images in this file.");
}
}
Also, is it possible to determine the file-type of the image with .rectangles.images.constructor.name
? I would like to add an extra case for say, PDF's or jpegs.