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

Change SmartObjects StackMode with JavaScript

New Here ,
Aug 02, 2019 Aug 02, 2019

Hi everyone,

I want to Change a SmartObjects Stackmode to Median using a Script.

You can do this in Photoshop like this:

Layer > Smart Objects > Stack Mode > Median.

How can this be done via JavaScript?

Thank you in advance!

TOPICS
Actions and scripting
487
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

Community Expert , Aug 02, 2019 Aug 02, 2019

Using ScriptListener, this is the code that I got for changing a smart objects stack mode to median.

var idapplyImageStackPluginRenderer = stringIDToTypeID( "applyImageStackPluginRenderer" );

    var desc3 = new ActionDescriptor();

    var idimageStackPlugin = stringIDToTypeID( "imageStackPlugin" );

    var idmedn = charIDToTypeID( "medn" );

    desc3.putClass( idimageStackPlugin, idmedn );

    var idNm = charIDToTypeID( "Nm  " );

    desc3.putString( idNm, """Median""" );

executeAction( idapplyImageSta

...
Translate
Adobe
Community Expert ,
Aug 02, 2019 Aug 02, 2019

Using ScriptListener, this is the code that I got for changing a smart objects stack mode to median.

var idapplyImageStackPluginRenderer = stringIDToTypeID( "applyImageStackPluginRenderer" );

    var desc3 = new ActionDescriptor();

    var idimageStackPlugin = stringIDToTypeID( "imageStackPlugin" );

    var idmedn = charIDToTypeID( "medn" );

    desc3.putClass( idimageStackPlugin, idmedn );

    var idNm = charIDToTypeID( "Nm  " );

    desc3.putString( idNm, """Median""" );

executeAction( idapplyImageStackPluginRenderer, desc3, DialogModes.NO );

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 ,
Aug 02, 2019 Aug 02, 2019
LATEST

Thank you so much, WORKED PERFECTLY!

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
Community Expert ,
Aug 02, 2019 Aug 02, 2019

And here is the same code run through Clean SL:

applyImageStackPluginRenderer("Median");

function applyImageStackPluginRenderer(name2) {

  var c2t = function (s) {

  return app.charIDToTypeID(s);

  };

  var s2t = function (s) {

  return app.stringIDToTypeID(s);

  };

  var descriptor = new ActionDescriptor();

  descriptor.putClass( s2t( "imageStackPlugin" ), c2t( "medn" ));

  descriptor.putString( s2t( "name" ), name2 );

  executeAction( s2t( "applyImageStackPluginRenderer" ), descriptor, DialogModes.NO );

}

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