Copy link to clipboard
Copied
Hi all,
there is a smartlayer with camera raw filter applied on it:
exposure 1.20
contrast: 20
vibrance 50
Now, I want to change one specific value only, lets say: change vibrance to 30.
How can I do it with a script, without resetting all other settings/values? just change vibrance to 30 only...
Thank you
function vibranceCRF(vibValue)
{
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("smartObject"));
r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var acr = executeActionGet(r).getObjectValue(stringIDToTypeID("smartObject")).getList(stringIDToTypeID("filterFX")).getObjectValue(0).getObjectValue(stringIDToTypeID("filter"));
var d = new ActionDescriptor();
var r = new A
...
Copy link to clipboard
Copied
Try here for starters:
Copy link to clipboard
Copied
EDIT: This may not work as intended...
vibranceCRF(vibValue = 30); // +30 vibrance
function vibranceCRF() {
var actDesc = new ActionDescriptor();
var vibrance = charIDToTypeID("Vibr");
actDesc.putInteger(vibrance, vibValue);
executeAction(stringIDToTypeID("Adobe Camera Raw Filter"), actDesc, DialogModes.NO);
}
This would add a new filter to the smart filter stack...
There would be the existing value of vibrance = 50
Then there would be a new, second smart filter value added = 30
This is not the same thing as changing 50 to 30.
Does anybody else have any ideas?
Copy link to clipboard
Copied
thank you for your answer.
I already manage to make a script, that changes/apply the settings to the current smart filter directly.
The problem is, that it resets all other settings, if there is no entry for it:
For example: following script would changes contrast and vibrance, but sets all others to zero....
is there a command to say:
desc762.putInteger( idCronetwo, "KEEP CURRENT VALUE" );
??
// ##############################################################
var idsetd = charIDToTypeID( "setd" );
var desc760 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref399 = new ActionReference();
var idfilterFX = stringIDToTypeID( "filterFX" );
ref399.putIndex( idfilterFX, 1 );
desc760.putReference( idnull, ref399 );
var idfilterFX = stringIDToTypeID( "filterFX" );
var desc761 = new ActionDescriptor();
var idFltr = charIDToTypeID( "Fltr" );
var desc762 = new ActionDescriptor();
var idCMod = charIDToTypeID( "CMod" );
desc762.putString( idCMod, """Filter""" );
// Change settings
// ##############################################################
var idCronetwo = charIDToTypeID( "Cr12" );
desc762.putInteger( idCronetwo, 15 ); // CONTRAST
var idVibr = charIDToTypeID( "Vibr" );
desc762.putInteger( idVibr, 20 ); // VIBRANCE
// ##############################################################
var idAdobeCameraRawFilter = stringIDToTypeID( "Adobe Camera Raw Filter" );
desc761.putObject( idFltr, idAdobeCameraRawFilter, desc762 );
var idfilterFX = stringIDToTypeID( "filterFX" );
desc760.putObject( idfilterFX, idfilterFX, desc761 );
executeAction( idsetd, desc760, DialogModes.NO );
Copy link to clipboard
Copied
function vibranceCRF(vibValue)
{
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("smartObject"));
r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var acr = executeActionGet(r).getObjectValue(stringIDToTypeID("smartObject")).getList(stringIDToTypeID("filterFX")).getObjectValue(0).getObjectValue(stringIDToTypeID("filter"));
var d = new ActionDescriptor();
var r = new ActionReference();
r.putIndex(stringIDToTypeID("filterFX"), 1);
r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(stringIDToTypeID("null"), r);
acr.putInteger(charIDToTypeID("Vibr"), vibValue);
//acr.put ... others
var d1 = new ActionDescriptor();
d1.putObject(stringIDToTypeID("filter"), stringIDToTypeID("Adobe Camera Raw Filter"), acr);
d.putObject(stringIDToTypeID("filterFX"), stringIDToTypeID("filterFX"), d1);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
}
Copy link to clipboard
Copied
thank you r-bin 1000 times!
thats just awesome and you just saved me hours of trial and error!
it works perfectly