Skip to main content
Participant
September 23, 2009
Question

move layermask from a layerSet to another one

  • September 23, 2009
  • 1 reply
  • 720 views

Hi all! I have read some documents and forums, but I just can't find the way to move a layermask from a layerset to another one, and eventually get selection from this layermask... so, you are my last hope to concretize my script! Thank you in advance for your help.

PS : Sorry for my english, which is not my native language.

This topic has been closed for replies.

1 reply

Inspiring
September 23, 2009

This moves a layer mask from the current layer to a layer with the name 'Layer 1'

function ftn1() {
  function cTID(s) { return app.charIDToTypeID(s); };
  function sTID(s) { return app.stringIDToTypeID(s); };

    var desc8 = new ActionDescriptor();
    desc8.putClass( cTID('Nw  '), cTID('Chnl') );
        var ref5 = new ActionReference();
        ref5.putEnumerated( cTID('Chnl'), cTID('Chnl'), cTID('Msk ') );
        ref5.putName( cTID('Lyr '), "Layer 1" );
    desc8.putReference( cTID('At  '), ref5 );
        var ref6 = new ActionReference();
        ref6.putEnumerated( cTID('Chnl'), cTID('Chnl'), cTID('Msk ') );
        ref6.putEnumerated( cTID('Lyr '), cTID('Ordn'), cTID('Trgt') );
    desc8.putReference( cTID('Usng'), ref6 );
    executeAction( cTID('Mk  '), desc8, DialogModes.NO );
};

This makes a selection from the mask of the current layer:

function ftn2() {
  function cTID(s) { return app.charIDToTypeID(s); };
  function sTID(s) { return app.stringIDToTypeID(s); };

    var desc15 = new ActionDescriptor();
        var ref11 = new ActionReference();
        ref11.putProperty( cTID('Chnl'), cTID('fsel') );
    desc15.putReference( cTID('null'), ref11 );
        var ref12 = new ActionReference();
        ref12.putEnumerated( cTID('Chnl'), cTID('Chnl'), cTID('Msk ') );
    desc15.putReference( cTID('T   '), ref12 );
    executeAction( cTID('setd'), desc15, DialogModes.NO );
};

This and more can be discovered via the Script Listener plugin.

Participant
September 23, 2009

Wow! Thanks for your help! It works very well! xbytor2, you are awesome!

The Script Listener plugin seems to be a great tool, thanks again for this help!