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

[ActionManager] Merge on top with Name

Advocate ,
Dec 08, 2015 Dec 08, 2015

Hi,

I vaguely recalled to have asked about this in the past (although my memory could fail me), but I can't find the post, maybe it was on ps-scripts.com

I'd need to pack into a single ActionManager step a "merge layer on top" (command + shift + option + E) with the layer name set.

My (unsuccessful) take is:

function s2t (s) { return app.stringIDToTypeID(s) }

var d1 = new ActionDescriptor();

d1.putBoolean(s2t('duplicate'), true);

// trying to set the name =======

var d2 = new ActionDescriptor();

d2.putString( s2t('name'), "some name");

d1.putObject(s2t('using'), s2t('layer'), d2);

// ======

executeAction(s2t('mergeVisible'), d1, DialogModes.NO);

Alas always the default name (which depends on the existing layers) is used.

I know it's not the end of the world to divide into 2 steps but... 😉

Thanks in advance for any suggestion,

Davide

TOPICS
Actions and scripting
255
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
Adobe
Guest
Dec 08, 2015 Dec 08, 2015
LATEST

Hi Davide,

So far, I've never found a way to achieve a stamp visible operation with a new layer name in one single step only.

Here is how I do it in some of my scripts, by creating first an empty layer:

function stampVisible (name)

{

    var desc1 = new ActionDescriptor ();

    var ref1 = new ActionReference ();

    ref1.putClass (app.stringIDToTypeID ("layer"));

    desc1.putReference (app.stringIDToTypeID ("target"), ref1);

    if (name)

    {

        var desc2 = new ActionDescriptor ();

        desc2.putString (app.stringIDToTypeID ("name"), name);

        desc1.putObject (app.stringIDToTypeID ("using"), app.stringIDToTypeID ("layer"), desc2);

    }

    app.executeAction (app.stringIDToTypeID ("make"), desc1, DialogModes.NO);

 

    var desc3 = new ActionDescriptor ();

    desc3.putBoolean (app.stringIDToTypeID ("duplicate"), true);

    app.executeAction (app.stringIDToTypeID ("mergeVisible"), desc3, DialogModes.NO);

}

stampVisible ("New Layer");

HTH,

--Mikaeru

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