Target action in javascript to specific layer instead of current layer
I am trying to set the tag color of a lyer in Photoshop. For this I used the action script listener and got the result below which is for the current selected layer. From an example I found on internet but for getting the current tag color I modified:
ref10.putEnumerated( idLyr, idOrdn, idTrgt );
to
But this still targets the currently selected layer, not the LayerSet one I passed via layer
Any hints would be welcome. Unfortunately I found no information about modifying logged actions for current layer for addressing a specific layer via its id.
// =======================================================
var idsetd = charIDToTypeID( "setd" );
var desc33 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref10 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref10.putEnumerated( idLyr, idOrdn, idTrgt );
desc33.putReference( idnull, ref10 );
var idT = charIDToTypeID( "T " );
var desc34 = new ActionDescriptor();
var idClr = charIDToTypeID( "Clr " );
var idClr = charIDToTypeID( "Clr " );
var idVlt = charIDToTypeID( "Vlt " );
desc34.putEnumerated( idClr, idClr, idVlt );
var idLyr = charIDToTypeID( "Lyr " );
desc33.putObject( idT, idLyr, desc34 );
executeAction( idsetd, desc33, DialogModes.NO );
