Hi,
I'm trying to find a way to select the layer above my current selection. The layer in question will be inside of a layerSet. I tried doing it with a for loop, but I couldn't figure out how to get the loop to start at the current selected layer. Also I thought about doing something like:
Find index of current layer
- 1 from that value
Select the layer with the subsequent index value
But I had trouble getting that figured out too.
Could someone help me out with this?
Thanks!
Select Layer Above Current
-
pfaffenbichler
Select Layer Above Current
Does this work for your purposes?
Code: Select all// =======================================================
var idslct = charIDToTypeID( "slct" );
var desc7 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref5 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idFrwr = charIDToTypeID( "Frwr" );
ref5.putEnumerated( idLyr, idOrdn, idFrwr );
desc7.putReference( idnull, ref5 );
var idMkVs = charIDToTypeID( "MkVs" );
desc7.putBoolean( idMkVs, false );
executeAction( idslct, desc7, DialogModes.NO );
Code: Select all// =======================================================
var idslct = charIDToTypeID( "slct" );
var desc7 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref5 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idFrwr = charIDToTypeID( "Frwr" );
ref5.putEnumerated( idLyr, idOrdn, idFrwr );
desc7.putReference( idnull, ref5 );
var idMkVs = charIDToTypeID( "MkVs" );
desc7.putBoolean( idMkVs, false );
executeAction( idslct, desc7, DialogModes.NO );