• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

use script to change a specific filter setting

Community Beginner ,
Jun 18, 2020 Jun 18, 2020

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

TOPICS
Actions and scripting

Views

1.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

People's Champ , Jun 19, 2020 Jun 19, 2020
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
...

Votes

Translate

Translate
Adobe
Community Expert ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 18, 2020 Jun 18, 2020

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?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 19, 2020 Jun 19, 2020

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 );

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jun 19, 2020 Jun 19, 2020

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);
    }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 19, 2020 Jun 19, 2020

Copy link to clipboard

Copied

LATEST

thank you r-bin 1000 times!

thats just awesome and you just saved me hours of trial and error!

it works perfectly

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines