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

[Q] Smoothing Toggle Script

New Here ,
Nov 08, 2017 Nov 08, 2017

Copy link to clipboard

Copied

Hi guys,

I'm not a programmer but I think this is the best section to ask this.

I'm wondering if it's possible to create a small JS script to toggle on/off the new Smoothing option in Photoshop CC 2018.

Thanks for reading!

R.

TOPICS
Actions and scripting

Views

649

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 , Nov 08, 2017 Nov 08, 2017

// try this

toggle_smoothing();

////////////////////////////////////////////////////////////////////////////////////////////

function toggle_smoothing()

    {

    try

        {

        var r = new ActionReference();

        r.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "tool" ) );

        r.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );

        var ret = executeActionGet(r);

        var desc = ret.getObjectValue(stringIDToTypeID("currentToolOptions"));

...

Votes

Translate

Translate
Adobe
People's Champ ,
Nov 08, 2017 Nov 08, 2017

Copy link to clipboard

Copied

// try this

toggle_smoothing();

////////////////////////////////////////////////////////////////////////////////////////////

function toggle_smoothing()

    {

    try

        {

        var r = new ActionReference();

        r.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "tool" ) );

        r.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );

        var ret = executeActionGet(r);

        var desc = ret.getObjectValue(stringIDToTypeID("currentToolOptions"));             

        if (desc.hasKey(stringIDToTypeID("smoothing")))

            {

            var smooth = desc.getBoolean(stringIDToTypeID("smoothing"));

            var tool = ret.getEnumerationType(stringIDToTypeID("tool"));

            desc.putBoolean(stringIDToTypeID("smoothing"), !smooth);

            var r = new ActionReference(); 

            r.putClass( tool ); 

            var desc2 = new ActionDescriptor(); 

            desc2.putReference( stringIDToTypeID( "null" ), r ); 

            desc2.putObject( stringIDToTypeID( "to" ), stringIDToTypeID( "null" ), desc ); 

            executeAction( stringIDToTypeID( "set" ), desc2, DialogModes.NO );

            }

        else

            {

            alert("Tool with no smoothing!");

            }

        }

    catch (e) { alert(e)  }

    }

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
New Here ,
Nov 08, 2017 Nov 08, 2017

Copy link to clipboard

Copied

LATEST

It works! Thank you very much r-bin!

I really appreciate the time you took to write the script.

You saved my life! ❤️

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