find text frame behind rectange
how to group if any text frame behind rectangle frame.
how to group if any text frame behind rectangle frame.
I have been in this forum for nearly 6 years.. this is how it works.. so guided you.. don't take it as personal..
This should help
Select the picky.
Trevor
// jshint undef: true, unused: true
var stopIfNot, picky, spread, spreadItems, l, itemsToTestForBounds, item, itemBounds, itemsToGroup, pickyBounds;
stopIfNot = function(condition, message) {
if (!condition) {
if (message) {
alert(message);
}
exit();
}
};
picky = spread = app.selection[0];
stopIfNot(spread, 'No Selection');
///////////////////////////
// Get the parent spread //
///////////////////////////
while (spread.constructor !== Spread) {
spread = spread.parent;
if (spread.constructor === Document) {
spread = false;
break;
}
}
stopIfNot(spread, 'No Spread found');
///////////////////////////////////////////
// Get objects behind the selected order //
///////////////////////////////////////////
spreadItems = spread.allPageItems;
l = spreadItems.length - 1;
itemsToTestForBounds = [];
while ((item = spreadItems[l--]) !== picky) {
if (item.parent.constructor !== Spread) {
continue; // only want out objects
}
itemsToTestForBounds.push(item);
}
if (itemsToTestForBounds.length) {
itemsToTestForBounds.push(picky);
}
itemsToGroup = [];
pickyBounds = picky.geometricBounds;
///////////////////////
// test for overlaps //
///////////////////////
l = itemsToTestForBounds.length;
while (l--) {
item = itemsToTestForBounds
; itemBounds = item.geometricBounds;
if (!(itemBounds[0] > pickyBounds[2] ||
itemBounds[2] < pickyBounds[0] ||
itemBounds[1] > pickyBounds[3] ||
itemBounds[3] < pickyBounds[1])) {
itemsToGroup.push(item);
}
}
////////////////////////////
// Group overlapped items //
////////////////////////////
newGroup = app.activeDocument.groups.add(itemsToGroup, picky.itemLayer);
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.