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

[Q] Smoothing Toggle Script

New Here ,
Nov 08, 2017 Nov 08, 2017

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
780
Translate
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"));

...
Translate
Adobe
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"));             

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

    }

Translate
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
LATEST

It works! Thank you very much r-bin!

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

You saved my life! ❤️

Translate
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