Issue getting height and width of selection
Hi,
I manage to get a script working on a basic simulation but not in real case.
My goal is to get the selection (everything in the document) height and width and copy it to a csv file.
I got this to work when I placed multiple shapes in the document and ran the script. I divide the result by 72 to get inches.
Now when I run it in a real case I get the size of one single shape.
Here's my script:
main();
function main(){
var doc = app.activeDocument;
var docTitle = doc.name;
var docTitle = docTitle.substring(0, docTitle.length - 4);
var textFile = File("C:/Galvo/" + docTitle + ".csv");
var docText1 ="";
var docText2 = "";
var docTextMid = ';';
var sel = doc.groupItems[0];
app.executeMenuCommand("selectall");
app.executeMenuCommand("ungroup");
app.executeMenuCommand("group");
var point1 = sel.width;
var point2 = sel.height;
docText1 = point1/72;
docText2 = point2/72;
textFile.open("w");
textFile.write(docText1 + docTextMid + docText2);
textFile.close();
}I group them as trying to get selection width gave me NaN (not a number). Figured that groups may work... I thought it was because I had multiple groups in the scene so I try to select all and ungroup. Looked at my document after the operation and I end up with only 1 group but I can't find it at the 0 index. Does groupItems get an item within the group? If so - How can I get the total document selection lenght and width?
Thank you.