Hi everybody,
this is my situation. I have a document with several pages and several objects on each page.
now I want to get the coordinates and the dimensions of a object and write down the datas as a XML-attribute.
The script should do this for every object in my document.
That's what i got so far:
function creatAtt(){
for (var i = 0; i < app.selection.length; i++){
var myObject = app.selection[i];
var myXMLobject = myObject.associatedXMLElement;
var ycoords = myObject.geometricBounds[0];
var xcoords = myObject.geometricBounds[1];
var width = myObject.geometricBounds[3] - myObject.geometricBounds[1];
var height = myObject.geometricBounds[2] - myObject.geometricBounds[0];
myXMLobject.xmlAttributes.add ("Y-Koordinate", ycoords.toString() + " px");
myXMLobject.xmlAttributes.add ("X-Koordinate", xcoords.toString() + " px");
myXMLobject.xmlAttributes.add ("Width", width.toString() + " px");
myXMLobject.xmlAttributes.add ("Height", height.toString() + " px");
}
}
creatAtt();
When I select a object and run the script it only writes the data for the selected object, not for all objects. Somebody a tip how to fix it???