Select ALL objects directly below an object
Is there a way to simply select all object directly below an objects?
I found this script here but it doesn't seem to work. Any ideas?
//DESCRIPTION:Select Below
// A Jongware Script
if (app.documents.length && app.selection.length)
{
ypos = app.selection[0].visibleBounds[3];
for (obj=1; obj<app.selection.length; obj++)
if (app.selection[obj].visibleBounds[3] < ypos)
ypos = app.selection[obj].visibleBounds[3];
for (obj=0; obj<app.activeDocument.pageItems.length; obj++)
try {
if (!app.activeDocument.pageItems[obj].hidden &&
!app.activeDocument.pageItems[obj].locked &&
app.activeDocument.pageItems[obj].visibleBounds[1] <= ypos)
app.activeDocument.pageItems[obj].selected = true;
} catch (_) { }
}
Here's an example file. I'm trying to select eveything below the yellow polygon.
This would be very useful in another project with many small objects bunch together below many larger objects. I want to group the small objects that are bellow the larger object together without having to manually select each objects (there are thousands of objects so a script would be ideal).