Skip to main content
Known Participant
February 12, 2025
Answered

Create new Hue/saturation layer by script

  • February 12, 2025
  • 1 reply
  • 360 views

hi all,

i want to create a hue/saturation adjustment layer.

i tried the following commands but failed:

app.activeDocument.artLayers.addAdjustment("Hue/Saturation");
app.activeDocument.layers.addAdjustment("Hue/Saturation");

 

please guide me the exact command.

Correct answer Stephen Marsh

@powerful_Zephyr5EF9 

 

I believe that you will need AM code for that:

 

var s2t = function (s) {
    return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
var reference = new ActionReference();
reference.putClass(s2t("contentLayer"));
descriptor.putReference(s2t("null"), reference);
descriptor2.putClass(s2t("type"), s2t("hueSaturation"));
descriptor.putObject(s2t("using"), s2t("contentLayer"), descriptor2);
executeAction(s2t("make"), descriptor, DialogModes.NO);

1 reply

Stephen Marsh
Stephen MarshCorrect answer
Adobe Expert
February 12, 2025

@powerful_Zephyr5EF9 

 

I believe that you will need AM code for that:

 

var s2t = function (s) {
    return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
var reference = new ActionReference();
reference.putClass(s2t("contentLayer"));
descriptor.putReference(s2t("null"), reference);
descriptor2.putClass(s2t("type"), s2t("hueSaturation"));
descriptor.putObject(s2t("using"), s2t("contentLayer"), descriptor2);
executeAction(s2t("make"), descriptor, DialogModes.NO);
Known Participant
February 12, 2025

thank you, it's work perfect.

Stephen Marsh
Adobe Expert
February 12, 2025

You're welcome, happy to help.