How do I traverse layerSets & artLayers in Extendscript?

775 views Asked by At

I'm familiar with CSS selectors and traversing in jQuery but can't work out how to do it in ExtendScript. I want to find the second to last folder in a layerSet and then go to the first LayerSet within it and select/focus it. I can't see how to go up and down PhotoShop's DOM (other than layerSets.length), nor how to specify a specific layerSets/artLayers without using names. Here's my lame attempt with made up stuff to demonstrate what I'm trying to do.

var topFolders = app.activeDocument.layerSets.length; //how many folders
var todayFolder = layerSetID(topFolders-1); //totally made up layerSetID()
app.activeDocument.activeLayer = todayFolder; //make folder active

I've been trawling photoshop_scriptref_js.pdf looking up things to do with name, index, select but can't find anything that I can understand fits my issue.

0

There are 0 answers