Skip to main content
Adobe Expert
February 13, 2023
Answered

ai script – select all objects on an Artboard but just from one Layer?

  • February 13, 2023
  • 3 replies
  • 1123 views

might be an easy one but I'm stuck here:

I want to select all Objects on one Artboard but only those from one exact Layer.

 

Details:

Using JavaScript I'm able to select all Objects on a specific Artboard.

Now is it possible to select everything from that Artboard being on specific Layer?

This might be one of many Layers.

Each Layer might contain Objects to be spread all over other Artboards...

 

Setting:

Multiple Artboards

Multiple Layers

Multiple Objects randomly on Layers/Artboards

 

Basic Script:

    for(var a=0; a<artboardRef.length; a++){
        docRef.artboards.setActiveArtboardIndex(a);
        docRef.selectObjectsOnActiveArtboard();
    }

 

Thanks

Nils

This topic has been closed for replies.
Correct answer femkeblanco

In addition to the two ways @CarlosCanto mentioned, you could select the items on the target layer, then deselect the items not on the target artboard, by comparing the bounds of each selected item with the bounds of the target artboard.

3 replies

femkeblanco
femkeblancoCorrect answer
Brainiac
February 13, 2023

In addition to the two ways @CarlosCanto mentioned, you could select the items on the target layer, then deselect the items not on the target artboard, by comparing the bounds of each selected item with the bounds of the target artboard.

CarlosCanto
Adobe Expert
February 13, 2023

you could lock or hide all layers (except the one you're interested in selecting) before Selecting all objects on artboard.

 

or you could select all objects like your current script, then loop through all selected objects, query what layer they belong to and deselect if they're not in the target layer

Kurt Gold
Adobe Expert
February 13, 2023

Just setting the desired layer to Isolation mode, then selecting all on active artboard (see Select menu) should work.

 

Isn't that an option?