Skip to main content
Inspiring
April 26, 2025
Answered

How to create a Hue/Saturation adjustment layer with ExtendScript/Action manager?

  • April 26, 2025
  • 1 reply
  • 294 views

Hello,

I found this script on this site to create a normal curve layer:

	var desc = new ActionDescriptor();
	var ref = new ActionReference();
	ref.putClass( charIDToTypeID( "AdjL" ) );
	desc.putReference( charIDToTypeID( "null" ), ref );
	var desc1 = new ActionDescriptor();
	desc1.putClass( charIDToTypeID( "Type" ), charIDToTypeID("Crvs" ) );
	desc.putObject( charIDToTypeID( "Usng" ), charIDToTypeID( "AdjL" ), desc1 );
	executeAction( charIDToTypeID( "Mk  " ), desc, DialogModes.NO );


Since the ScriptingListener plugin no longer works with my new Mac and/or my new Photoshop, I'm looking for a similar script to create a Hue/Saturation adjustment layer.

 

Thank you.

Correct answer Stephen Marsh

@frmorel 

 

Raw SL recording:

 

var idmake = stringIDToTypeID( "make" );
    var desc237 = new ActionDescriptor();
    var idnull = stringIDToTypeID( "null" );
        var ref23 = new ActionReference();
        var idadjustmentLayer = stringIDToTypeID( "adjustmentLayer" );
        ref23.putClass( idadjustmentLayer );
    desc237.putReference( idnull, ref23 );
    var idusing = stringIDToTypeID( "using" );
        var desc238 = new ActionDescriptor();
        var idtype = stringIDToTypeID( "type" );
            var desc239 = new ActionDescriptor();
            var idpresetKind = stringIDToTypeID( "presetKind" );
            var idpresetKindType = stringIDToTypeID( "presetKindType" );
            var idpresetKindDefault = stringIDToTypeID( "presetKindDefault" );
            desc239.putEnumerated( idpresetKind, idpresetKindType, idpresetKindDefault );
            var idcolorize = stringIDToTypeID( "colorize" );
            desc239.putBoolean( idcolorize, false );
        var idhueSaturation = stringIDToTypeID( "hueSaturation" );
        desc238.putObject( idtype, idhueSaturation, desc239 );
    var idadjustmentLayer = stringIDToTypeID( "adjustmentLayer" );
    desc237.putObject( idusing, idadjustmentLayer, desc238 );
executeAction( idmake, desc237, DialogModes.NO );

 

Or run through Clean SL:

 

var s2t = function (s) {
	return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
var descriptor3 = new ActionDescriptor();
var reference = new ActionReference();
reference.putClass( s2t( "adjustmentLayer" ));
descriptor.putReference( s2t( "null" ), reference );
descriptor3.putEnumerated( s2t( "presetKind" ), s2t( "presetKindType" ), s2t( "presetKindDefault" ));
descriptor3.putBoolean( s2t( "colorize" ), false );
descriptor2.putObject( s2t( "type" ), s2t( "hueSaturation" ), descriptor3 );
descriptor.putObject( s2t( "using" ), s2t( "adjustmentLayer" ), descriptor2 );
executeAction( s2t( "make" ), descriptor, DialogModes.NO );

1 reply

Stephen Marsh
Stephen MarshCorrect answer
Community Expert
April 26, 2025

@frmorel 

 

Raw SL recording:

 

var idmake = stringIDToTypeID( "make" );
    var desc237 = new ActionDescriptor();
    var idnull = stringIDToTypeID( "null" );
        var ref23 = new ActionReference();
        var idadjustmentLayer = stringIDToTypeID( "adjustmentLayer" );
        ref23.putClass( idadjustmentLayer );
    desc237.putReference( idnull, ref23 );
    var idusing = stringIDToTypeID( "using" );
        var desc238 = new ActionDescriptor();
        var idtype = stringIDToTypeID( "type" );
            var desc239 = new ActionDescriptor();
            var idpresetKind = stringIDToTypeID( "presetKind" );
            var idpresetKindType = stringIDToTypeID( "presetKindType" );
            var idpresetKindDefault = stringIDToTypeID( "presetKindDefault" );
            desc239.putEnumerated( idpresetKind, idpresetKindType, idpresetKindDefault );
            var idcolorize = stringIDToTypeID( "colorize" );
            desc239.putBoolean( idcolorize, false );
        var idhueSaturation = stringIDToTypeID( "hueSaturation" );
        desc238.putObject( idtype, idhueSaturation, desc239 );
    var idadjustmentLayer = stringIDToTypeID( "adjustmentLayer" );
    desc237.putObject( idusing, idadjustmentLayer, desc238 );
executeAction( idmake, desc237, DialogModes.NO );

 

Or run through Clean SL:

 

var s2t = function (s) {
	return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
var descriptor3 = new ActionDescriptor();
var reference = new ActionReference();
reference.putClass( s2t( "adjustmentLayer" ));
descriptor.putReference( s2t( "null" ), reference );
descriptor3.putEnumerated( s2t( "presetKind" ), s2t( "presetKindType" ), s2t( "presetKindDefault" ));
descriptor3.putBoolean( s2t( "colorize" ), false );
descriptor2.putObject( s2t( "type" ), s2t( "hueSaturation" ), descriptor3 );
descriptor.putObject( s2t( "using" ), s2t( "adjustmentLayer" ), descriptor2 );
executeAction( s2t( "make" ), descriptor, DialogModes.NO );