Hi, I've inspected the scripting listener code generated by dragging the topmost layer's mask to the layer below, substituting it. Basically I start with this configuration: and the result is this: the recorded ActionManager is:
var idMk = charIDToTypeID( "Mk " );
var desc215 = new ActionDescriptor();
var idNw = charIDToTypeID( "Nw " );
var idChnl = charIDToTypeID( "Chnl" );
desc215.putClass( idNw, idChnl );
var idAt = charIDToTypeID( "At " );
var ref112 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
var idChnl = charIDToTypeID( "Chnl" );
var idMsk = charIDToTypeID( "Msk " );
ref112.putEnumerated( idChnl, idChnl, idMsk );
var idLyr = charIDToTypeID( "Lyr " );
ref112.putName( idLyr, "Target" );
desc215.putReference( idAt, ref112 );
var idUsng = charIDToTypeID( "Usng" );
var ref113 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
var idChnl = charIDToTypeID( "Chnl" );
var idMsk = charIDToTypeID( "Msk " );
ref113.putEnumerated( idChnl, idChnl, idMsk );
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref113.putEnumerated( idLyr, idOrdn, idTrgt );
desc215.putReference( idUsng, ref113 );
executeAction( idMk, desc215, DialogModes.NO );
which I've refactored for clarity's sake as:
function c2t (c) { return app.charIDToTypeID(c) }
var d1 = new ActionDescriptor();
var r1 = new ActionReference();
var r2 = new ActionReference();
d1.putClass( s2t('new'), s2t('channel') );
r1.putEnumerated( s2t('channel', s2t('channel'), s2t('mask') );
r1.putName( s2t('layer'), 'Target');
d1.putReference( s2t('at'), r1 );
r2.putEnumerated( s2t('channel'), s2t('channel'), s2t('mask') );
r2.putEnumerated( s2t('layer'), s2t('ordinal'), s2t('targetEnum') );
d1.putReference( s2t('using'), r2 );
executeAction( s2t('make'), d1, DialogModes.NO );
Now, for some reason if I go back to the very exact starting point (first screenshot) and I run the above code - no matter whether the refactored or original version - I got the usual "General Photoshop error, etc" that happens when your AM code is wrong and/or tries to perform some action that is forbidden. I wonder whether this is a scriptinglistener recording bug or something else. I've seen that the code runs "almost" correctly if the bottom layer has no mask - in this case the mask is not moved but duplicated (i.e. same mask for both the layer above and below). So possibly the SL code is missing the "replace" existing mask and "move" mask part - is hard to guess what they should be... Thank you in advance for any help, Davide Barranca --- www.davidebarranca.com www.cs-extensions.com
... View more