Copy link to clipboard
Copied
Is there no way to target a layer with layerindex or reference to alter the adjustment layer? I really don't want to select it first because it makes the script slow and jumping all over the layer stack while processing.
Everything I try just gives me errors on the setd.
This is an example of what I want to do, but without selecting the layer:
var ref1 = new ActionReference();
ref1.putEnumerated(cTID('AdjL'), cTID('Ordn'), cTID('Trgt'));
var desc1 = new ActionDescriptor();
desc1.putReference(cTID('null'), ref1);
var desc2 = new ActionDescriptor();
desc2.putInteger(cTID('Rd '), 1);
desc2.putInteger(cTID('Yllw'), 2);
desc2.putInteger(cTID('Grn '), 3);
desc2.putInteger(cTID('Cyn '), 4);
desc2.putInteger(cTID('Bl '), 5);
desc2.putInteger(cTID('Mgnt'), 6);
desc2.putBoolean(sTID("useTint"), false);
desc1.putObject(cTID('T '), cTID('BanW'), desc2);
executeAction(cTID('setd'), desc1, DialogModes.NO);
ref1.putEnumerated(cTID('AdjL'), cTID('Ordn'), cTID('Trgt'));
ref1.putIndex( charIDToTypeID( "AdjL" ), 5 );
Copy link to clipboard
Copied
ref1.putEnumerated(cTID('AdjL'), cTID('Ordn'), cTID('Trgt'));
ref1.putIndex( charIDToTypeID( "AdjL" ), 5 );
Copy link to clipboard
Copied
But as the index could change with the adding, removing, changing the order of Layers it mght be better to use the identifier to target the Layer, that »sticks«.
Copy link to clipboard
Copied
ref1.putName(stringIDToTypeID("adjustmentLayer"), "Black & White 1");
or
ref1.putIdentifier(stringIDToTypeID("adjustmentLayer"), activeDocument.artLayers[0].id);
P.S. Missing spaces in your code, e.g. in cTID('Rd ')
Copy link to clipboard
Copied
Very nice and quick response! Thanks guys! I swear I tried exactly this, but I must have missed something. It now works! YAY!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more