Hi all,
I didn't try the DOM method as I figured out the mathematical method.
I won't give great results if a shear has been applied but that doesn't bother me as I am not applying shears 
I got from http://stackoverflow.com/questions/9971230/calculate-rotated-rectangle-size-from-known-bounding-box-coordinates a useful formula
y = (1/(Math.cos(a) * Math.cos(a) - Math.sin(a) * Math.sin(a))) * (- w * Math.sin(a) + h * Math.cos(a));
where y is the height of the inner box when no rotation is applied to it and a is the angle of rotation and w is the width.
I had figured out for myself a different formula but got stuck when getting to rotations outside the 90 degree range i.e. -1 degree or 91 degrees.
The same problem occurred with this method so a made the following fix.
a = rads ((360 + degs(a)) % 90);
I did the temporary conversion to degrees as I seem to remember problems with applying Mod by a fraction, I think Ariel had a thread on that in the indesign forum.
These are the results of the script


// draw a text box and rotate it before running the script
// By Trevor www.creative-scripts.com (sorry still not too much there)
// https://forums.adobe.com/message/7678561#7678561
// With a little bit of help from http://stackoverflow.com/questions/9971230/calculate-rotated-rectangle-size-from-known-bounding-box-coordinates
function main () {
var doc = app.documents.length && app.activeDocument,
itext = doc && doc.textFrames[0];
if (!itext) {
alert ("Sorry mate,\nI need a document with a textFrameItem on it or there's not much for me to do");
return "twit";
}
var gb = itext.geometricBounds,
imatrix = itext.matrix,
p1X, p1Y, p2X, p2Y, p3X, p3Y, p4X, p4Y,
a, h, w, x, y, hyp, op, adj,
noColor = new NoColor(),
rgbColor = new RGBColor(),
newShape = doc.pathItems.add(),
rect;
;
// Do the maths
a = Math.atan2 (imatrix.mValueB, imatrix.mValueA); // get the angle of the textFrameItem
a = rads ((360 + degs(a)) % 90); // make sure it's positive otherwise the result will get messed up
w = gb[2] - gb[0]; // Width of outer enclosing box
h = gb[1] - gb[3]; // Height of outer enclosing box
/* x = (1/(Math.cos(a) * Math.cos(a) - Math.sin(a) * Math.sin(a))) * (w * Math.cos(a) - h * Math.sin(a)); // Width of inner enclosed box, this is not needed for this script */
y = (1/(Math.cos(a) * Math.cos(a)- Math.sin(a) * Math.sin(a))) * (- w * Math.sin(a) + h * Math.cos(a)); // Height of inner enclosed box
op = Math.sin(a) * y; // this is the x coordinate offset
adj = Math.cos(a) * y; // this is the y coordinate offset
// calculate the points of the inner enclosed box
p1X = gb[0] + op; // left bottom
p1Y = gb[3];
p2X = gb[0]; // left top
p2Y = gb[3] + adj;
p3X = gb[2] - op; // right top
p3Y = gb[1];
p4X = gb[2]; // right bottom
p4Y = gb[1] - adj;
// Draw outer box
rgbColor.blue = 255;
rect = doc.pathItems.rectangle(gb[1], gb[0], gb[2]-gb[0], Math.abs(gb[3]-gb[1]) );
rect.fillColor = noColor;
rect.strokeColor = rgbColor;
// Draw inner box
newShape.setEntirePath([[p1X, p1Y], [p2X, p2Y], [p3X, p3Y], [p4X, p4Y], [p1X, p1Y]]);
rgbColor.red = 255;
newShape.strokeColor = rgbColor;
newShape.fillColor = noColor;
// Helper functions
function rads (x) {return x * (Math.PI / 180);}
function degs (x) {return x * (180 / (Math.PI));}
}
main()
Hi Uwe,
It was late but I don't know how I missed the path object. Getting old!
A good thing I didn't post it on the InDesign forum, at least here I can expect less sniggers for such a dumb look-over than I would get in the InDesign forum 
Either-way thanks to you both, regards,
Trevor