Answered
Shortcut to find shortened text boxes
Is there a GREP etc way to find quickly all pages in a doc in which the text boxes have been manually shortened
Is there a GREP etc way to find quickly all pages in a doc in which the text boxes have been manually shortened
Hi Manan, yes, that's exactly what is needed.
Not doable via Grep but script may help. Try the following code.
var doc = app.documents[0];
var tolerance = 0.5; // in points — tweak if needed
for (var i = 0; i < doc.pages.length; i++) {
var page = doc.pages[i];
var mp = page.marginPreferences;
var top = page.bounds[0] + mp.top;
var bottom = page.bounds[2] - mp.bottom;
var left = page.bounds[1] + mp.left;
var right = page.bounds[3] - mp.right;
var marginWidth = right - left;
var marginHeight = bottom - top;
if (page.textFrames.length > 0) {
var tf = page.textFrames[0];
var gb = tf.geometricBounds;
var tfHeight = gb[2] - gb[0];
var tfWidth = gb[3] - gb[1];
var widthDiff = Math.abs(tfWidth - marginWidth);
var heightDiff = Math.abs(tfHeight - marginHeight);
if (widthDiff > tolerance || heightDiff > tolerance) {
alert("Page " + page.name + " has a mismatched text frame.");
}
}
}
Do note the following
-Manan
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.