here you go
#target Illustrator
// script by grizzlyburr?
myDoc = app.activeDocument;
findDims(app.selection);
function findDims(objs) {
for (i=objs.length-1; i>=0; i--) { //loop through your collection of objects
var vb = objs.geometricBounds; // left, top, right, bottom // * changed to geometricBounds
var w = (vb[2] - vb[0]);
var h = (vb[1] - vb[3]);
if (objs.parent.typename != "GroupItem") { // Check if parent is a groupItem
descFrame = myDoc.tex
...