Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Modify Adjustment Layer without selecting it? (Scripting)

Explorer ,
May 01, 2020 May 01, 2020

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

 

TOPICS
Actions and scripting
1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 01, 2020 May 01, 2020
Instead of 

 

ref1.putEnumerated(cTID('AdjL'), cTID('Ordn'), cTID('Trgt'));

 

make it

 

ref1.putIndex( charIDToTypeID( "AdjL" ), 5 );

 

and obviously insert the correct Index-number. 
 
Translate
Adobe
Community Expert ,
May 01, 2020 May 01, 2020
Instead of 

 

ref1.putEnumerated(cTID('AdjL'), cTID('Ordn'), cTID('Trgt'));

 

make it

 

ref1.putIndex( charIDToTypeID( "AdjL" ), 5 );

 

and obviously insert the correct Index-number. 
 
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 01, 2020 May 01, 2020

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«. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
May 01, 2020 May 01, 2020

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 01, 2020 May 01, 2020
LATEST

Very nice and quick response! Thanks guys! I swear I tried exactly this, but I must have missed something. It now works! YAY!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines