Skip to main content
Participating Frequently
December 25, 2023
Question

Adobe ExtendScript get array of manual selection

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 is closed to new replies. Start a new post to keep the conversation going.

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

Translate
Legend
December 25, 2023

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

Translate
m1b
Community Expert
Community Expert
December 25, 2023

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

Translate
m1b
Community Expert
Community Expert
December 25, 2023

I think you would need the SDK to do that. 

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

Translate
Participating Frequently
December 25, 2023

Hey there 👋

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

Translate