Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

How can I color a layer without selecting it?

$
0
0

I have this little function which is working fine except the slow layer selection. Could someone show me the way how to color a layer without actually go there and higlight it with selection? As You can see the line 13. is the selection. Would be nice if We could get rid of it somehow.

 

colorLayer = function( layerIndex, colorNAME )
{    var color = { "GREEN": "Grn ", "RED": "Rd  ", "BLUE": "Bl  ", "ORANGE": "Orng", "YELLOW": "Ylw ", "VIOLET": "Vlt ", "GRAY": "Gry ", "NONE": "None" }[ colorNAME ];    var desc1 = new ActionDescriptor();    var ref1 = new ActionReference();    ref1.putIndex( charIDToTypeID( "Lyr " ), layerIndex );    desc1.putReference( charIDToTypeID( "null" ), ref1 );    var desc2 = new ActionDescriptor();    desc2.putEnumerated( charIDToTypeID( "Clr " ), charIDToTypeID( "Clr " ), charIDToTypeID( color ) );    desc1.putObject( charIDToTypeID( "T   " ), charIDToTypeID( "Lyr " ), desc2 );    executeAction( charIDToTypeID( 'slct' ), desc1, DialogModes.NO );    executeAction( charIDToTypeID( "setd" ), desc1, DialogModes.NO );
}

 

Is there a 'trgt' or something instead of 'slct'? Where can I learn about these IDs?


Viewing all articles
Browse latest Browse all 12244

Trending Articles