Alternatively, see if this works for you:
var text1 = app.selection[0];
if (text1 == undefined || text1.typename != "TextFrame") {
alert("You did not select a textFrame.");
} else {
var string = "Family: " + text1.textRange.characterAttributes.textFont.family + "\
Name: " + text1.textRange.characterAttributes.textFont.name + "\
Style: " + text1.textRange.characterAttributes.textFont.style + "\
Size: " + text1.textRange.characterAttributes.size + "\
Leading: " + text1.textRange.characterAttributes.leading + "\
Tracking: " + text1.textRange.characterAttributes.tracking;
}
var top = app.selection[0].position[1];
var left = app.selection[0].position[0];
var h = app.selection[0].height;
var w = app.selection[0].width;
var rect1 = app.activeDocument.pathItems.rectangle(top, left, w, h);
rect1.strokeColor = app.activeDocument.swatches["CMYK Cyan"].color;
rect1.strokeWidth = 2.5;
rect1.filled = false;
var rect2 = app.activeDocument.pathItems.rectangle(top, left-200, 200, 200);
rect2.stroked = false;
var text2 = app.activeDocument.textFrames.areaText(rect2);
text2.contents = string;
text2.textRange.characterAttributes.textFont = textFonts["ArialMT"];
text2.textRange.characterAttributes.size = 15;
text2.textRange.fillColor = app.activeDocument.swatches["CMYK Cyan"].color;
