Adobe ExtendScript get array of manual selection
Copy link to clipboard
Copied
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?
Explore related tutorials & articles
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Hey there 👋
yes correct, that would be required. Still many thanks for your quick response 👍
Copy link to clipboard
Copied
I think you would need the SDK to do that.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Ouch, above applies to InDesign, I did not realize that this discussion is about Illustrator.
Copy link to clipboard
Copied
Haha, I make that mistake regularly! Nice to see I'm not alone. 🙂
Copy link to clipboard
Copied
Oh I see, still many thanks to both of you ☺
As of now, it isn't tragic, would simply have been an additional nice to have. However, I edited the setAllThings script from Wundes to copy all four transform settings (x,y, width, height) of a specific object / layer to all other selected one's.
This anyway, isn't a use case I encounter very often, therefore I am fine that I at least orientate myself on the most upper layer as the origin for the transform values to be copied.
Many thanks to all answerers and Merry Christmas 🎅

