Here with the files
https://we.tl/t-aGwruwK7if
Try this
var doc = app.activeDocument;
var textFrames = doc.textFrames;
var numTextFrames = textFrames.length;
for (var i = 0; i < numTextFrames; i++) {
var tf = textFrames[i];
if (tf.kind == TextType.AREATEXT &&
tf.contents.length > 0 &&
overflows(tf)) {
alert("Overset text detected in text frame " + (i + 1));
// tf.selected = true;
}
}
function overflows(tf) {
var lastLine = tf.lines[tf.lines.length - 1];
var textRange1 = lastLine.contents;
var textRange2 = "";
var i = tf.characters.length - 1;
var difference = (tf.characters.length - lastLine.contents.length) - 1;
var lastChar = tf.characters[tf.characters.length - 1].contents;
for (var j = 0; j < 32; j++) {
if (lastChar == String.fromCharCode(j) && lastChar != "\t") {
i--, difference--;
break;
}
}
for (i; i > difference; i--) {
textRange2 = tf.characters[i].contents + textRange2;
}
return textRange1 != textRange2;
}