Copy link to clipboard
Copied
Hello,
I'm trying to load a Curves Adjustment Layer with an acv.preset (named: Enhancement), but the ScriptListener doesn't recognize the selection of Curves presets:
// =======================================================
var idMk = charIDToTypeID( "Mk " );
var desc151 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref127 = new ActionReference();
var idAdjL = charIDToTypeID( "AdjL" );
ref127.putClass( idAdjL );
desc151.putReference( idnull, ref127 );
var idUsng = charIDToTypeID( "Usng" );
var desc152 = new ActionDescriptor();
var idNm = charIDToTypeID( "Nm " );
desc152.putString( idNm, """Colour Enhancement""" );
var idMd = charIDToTypeID( "Md " );
var idBlnM = charIDToTypeID( "BlnM" );
var idClr = charIDToTypeID( "Clr " );
desc152.putEnumerated( idMd, idBlnM, idClr );
var idClr = charIDToTypeID( "Clr " );
var idClr = charIDToTypeID( "Clr " );
var idRd = charIDToTypeID( "Rd " );
desc152.putEnumerated( idClr, idClr, idRd );
var idType = charIDToTypeID( "Type" );
var desc153 = new ActionDescriptor();
var idpresetKind = stringIDToTypeID( "presetKind" );
var idpresetKindType = stringIDToTypeID( "presetKindType" );
var idpresetKindDefault = stringIDToTypeID( "presetKindEnhancement" );
desc153.putEnumerated( idpresetKind, idpresetKindType, idpresetKindDefault );
var idCrvs = charIDToTypeID( "Crvs" );
desc152.putObject( idType, idCrvs, desc153 );
var idAdjL = charIDToTypeID( "AdjL" );
desc151.putObject( idUsng, idAdjL, desc152 );
executeAction( idMk, desc151, DialogModes.NO );
I tried this script, which I was able to find on PS Scripting, but it doesn't seem to work either:
function makeCurvesAdjustmentLayerFromAcvFile (acvFilePath)
{
var desc8 = new ActionDescriptor ();
var ref2 = new ActionReference ();
ref2.putClass (stringIDToTypeID ("adjustmentLayer"));
desc8.putReference (stringIDToTypeID ("target"), ref2);
var desc9 = new ActionDescriptor ();
var desc10 = new ActionDescriptor ();
desc10.putEnumerated (stringIDToTypeID ("presetKind"), stringIDToTypeID ("presetKindType"), stringIDToTypeID ("presetKindUserDefined"));
desc10.putPath (stringIDToTypeID ("using"), new File (acvFilePath));
desc9.putObject (stringIDToTypeID ("type"), stringIDToTypeID ("curves"), desc10);
desc8.putObject (stringIDToTypeID ("using"), stringIDToTypeID ("adjustmentLayer"), desc9);
executeAction (stringIDToTypeID ("make"), desc8, DialogModes.NO);
}
makeCurvesAdjustmentLayerFromAcvFile ("~/Desktop/Enhancement.acv");
I catch an error an error on this line:
executeAction (stringIDToTypeID ("make"), desc8, DialogModes.NO);
Any and all help would be greatly appreciated!
Thanks,
-Eric
Copy link to clipboard
Copied
I just tried recording a preset and it seemed to work. The below script has two parts. The first creates the curves adjustment layer, the second sets the curves to the preset. If you have a curves adjustment layer selected, you don't need to run the first part.
var idMk = charIDToTypeID( "Mk " );
var desc45 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref11 = new ActionReference();
var idAdjL = charIDToTypeID( "AdjL" );
ref11.putClass( idAdjL );
desc45.putReference( idnull, ref11 );
var idUsng = charIDToTypeID( "Usng" );
var desc46 = new ActionDescriptor();
var idType = charIDToTypeID( "Type" );
var desc47 = new ActionDescriptor();
var idpresetKind = stringIDToTypeID( "presetKind" );
var idpresetKindType = stringIDToTypeID( "presetKindType" );
var idpresetKindDefault = stringIDToTypeID( "presetKindDefault" );
desc47.putEnumerated( idpresetKind, idpresetKindType, idpresetKindDefault );
var idCrvs = charIDToTypeID( "Crvs" );
desc46.putObject( idType, idCrvs, desc47 );
var idAdjL = charIDToTypeID( "AdjL" );
desc45.putObject( idUsng, idAdjL, desc46 );
executeAction( idMk, desc45, DialogModes.NO );
// =======================================================
var idsetd = charIDToTypeID( "setd" );
var desc48 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref12 = new ActionReference();
var idAdjL = charIDToTypeID( "AdjL" );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref12.putEnumerated( idAdjL, idOrdn, idTrgt );
desc48.putReference( idnull, ref12 );
var idT = charIDToTypeID( "T " );
var desc49 = new ActionDescriptor();
var idpresetKind = stringIDToTypeID( "presetKind" );
var idpresetKindType = stringIDToTypeID( "presetKindType" );
var idpresetKindUserDefined = stringIDToTypeID( "presetKindUserDefined" );
desc49.putEnumerated( idpresetKind, idpresetKindType, idpresetKindUserDefined );
var idUsng = charIDToTypeID( "Usng" );
desc49.putPath( idUsng, new File( "C:\\Users\\Chuck\\AppData\\Roaming\\Adobe\\Adobe Photoshop CC 2017\\Presets\\Curves\\test for script.acv" ) );
var idCrvs = charIDToTypeID( "Crvs" );
desc48.putObject( idT, idCrvs, desc49 );
executeAction( idsetd, desc48, DialogModes.NO );
Copy link to clipboard
Copied
Thanks for the assist! When I run your script (CS6), It shows that it is 'Modifying the Curves Layer' in the history palette,... however the actual modification is not occurring. The preset is not activated. Not sure what I'm doing wrong....
Thanks,
-Eric
Copy link to clipboard
Copied
I'm running cc2017, so there will be differences.
Copy link to clipboard
Copied
Just tried to run my old copy of CS6 and scriptlistener. It wouldn't record anything, so I'm not sure what's going on with what you want to know.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now