Skip to main content
Participant
February 22, 2014
Question

Select ALL objects directly below an object

  • February 22, 2014
  • 1 reply
  • 877 views

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).

This topic has been closed for replies.

1 reply

Inspiring
February 22, 2014

You're misinterpreting the script you found, jongware stated "The other selected objects must lie entirely below the lowest point", he is talking about the "Y position" not the stacking order. See below.

One of these scripts by CarlosCanto may be closer to what you're actually after:

http://forums.adobe.com/message/3660118

http://forums.adobe.com/thread/856221?start=0