Skip to main content
Participating Frequently
December 25, 2023
Question

Adobe ExtendScript get array of manual selection

  • December 25, 2023
  • 3 replies
  • 760 views

I am using 

app.activeDocument.selection

 

This includes an array of my selection, however indexed based on the selected layers from top(index = 0) to bottom (index = app.activeDocument.selection.length - 1).

 

What I would like to have is the order of my manual object / layer selection. Is this possible?

This topic has been closed for replies.

3 replies

Legend
December 25, 2023

You can watch selection changes with the "afterSelectionChanged" handler.

Create a shadow variable starting from the previous selection.

Push newly added items (to back), and remove those removed items.

You'd do this for each separate window (the event target).

 

Layer selections? Panel selections e.g. in the layers panel are not exposed. You'd need a plug-in for that.

Legend
December 25, 2023

Ouch, above applies to InDesign, I did not realize that this discussion is about Illustrator. 

m1b
Community Expert
Community Expert
December 25, 2023

Haha, I make that mistake regularly! Nice to see I'm not alone. 🙂

m1b
Community Expert
Community Expert
December 25, 2023

I think you would need the SDK to do that. 

femkeblanco
Legend
December 25, 2023

Do you mean the order in which the items were selected (which item was selected before/after which)?  If so, no, it's not possible. 

Participating Frequently
December 25, 2023

Hey there 👋

yes correct, that would be required. Still many thanks for your quick response 👍