Select Layer Above Current

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

applezap

Select Layer Above Current

Post by applezap »

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!

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

pfaffenbichler

Select Layer Above Current

Post by pfaffenbichler »

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 );