Allow scripts (AppleScript, Javascript) to retrieve a full list of all selected layers
Currently, you can ask Illustrator what layer is selected, but if a user has more than one layer selected, it won't give a list or array of all selected layers. It will still just give you one layer. So many scripts I write have to do with changing properties of multiple layers like batch renaming or batch recolouring. The workaround is to ask the end user to lock all layers they don't want to be affected. It would be much more natural for them to just select the layers they want to be affected.
-
Brennan Young commented
Layer does not have a selected property in the object model, but there is "has selected artwork" which might work for you.
You can use a filter reference form (a "whose" clause) to get all the layers with selected artwork. Example:
tell application "Adobe Illustrator"
layers of document 1 whose has selected artwork is true
end tell -
Anonymous commented
Hi Team,
When this feature going to be available?
I have the attached script that would automate this for us but I can't use it since the layers location seems to be read only? please note you need to rename it to .py to run the script.
Thanks,
Gabor Balogh
IT technician - SCHAWK Manchester