Fnykis
4/28/2020 - 1:16 PM

Set colorize for Hue/Saturation

function setColorize(hue, saturation, lightness) {
    var desc6 = new ActionDescriptor();
    var desc7 = new ActionDescriptor();
    var desc8 = new ActionDescriptor();
    var list1 = new ActionList();
    var ref3 = new ActionReference();
    ref3.putEnumerated( charIDToTypeID( "AdjL" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ));
    desc6.putReference( charIDToTypeID( "null" ), ref3 );
    desc7.putEnumerated( stringIDToTypeID( "presetKind" ), stringIDToTypeID( "presetKindType" ), stringIDToTypeID( "presetKindCustom" ));
    desc7.putBoolean( charIDToTypeID( "Clrz" ), true );
    desc8.putEnumerated( charIDToTypeID( "Chnl" ), charIDToTypeID( "Chnl" ), charIDToTypeID( "Cmps" ));
    desc8.putInteger( charIDToTypeID( "H   " ), hue );  /// HUE
    desc8.putInteger( charIDToTypeID( "Strt" ), saturation ); /// SATURATION
    desc8.putInteger( charIDToTypeID( "Lght" ), lightness ); /// LIGHTNESS
    list1.putObject( charIDToTypeID( "Hst2" ), desc8 );
    desc7.putList( charIDToTypeID( "Adjs" ), list1 );
    desc6.putObject( charIDToTypeID( "T   " ), charIDToTypeID( "HStr" ), desc7 );
    executeAction( charIDToTypeID( "setd" ), desc6, DialogModes.NO );
}