Copy link to clipboard
Copied
Hi everybody.
I´m searching an understandable way to create a mask on my top-layer-set. There are not really many threads on the subject. For exemple this one.
Can somebody tell me where is the line where a mask will be created? I am a beginner in scripting, but I still understand a lot if it is has a logical background. But here I cannot recognize one!
I just want to understand it. In the "Script UI for Dummies" it isn't explaned neither.
The Task: I have a top layer set that contains 8 more. At this top set I need a mask with special dimensions and a certain position.
Please try to explain first, not to script.
Thanks in advance!
Copy link to clipboard
Copied
Okay, as I recognized, there is only one to deal with it: the ScriptingListener. Unfortunately I depend on an Adminstrator...
Copy link to clipboard
Copied
The only way I know how to add a layer mask in a script is with action manager code. Adobe Scriptlitener Plug-in is not required to be installed. However it is very handy to generate Action manager code.
There are many ways to add layer mask so the Action manager code would vary with method used.
I have automated Populating my Photo Collage Temple design. It easy to create Photoshop Framed image layers. Adobe seems to be making it hard. All that is required are image area maps. All that is required for that is a selection. These can be saves as Alpha Channels Image Number Image maps. All that is required for a Photo collage template is a background canvas and alpha channel image maps. It can't get simpler than that.
So in my scripts I use these maps to resize images, position the resized images, and to mask the resized images. The way I add layer mask is to the image lay is I add the active selection created using select load save selection (The alpha Channels image maps) as a layer mask on the active image layer that has been place in and resized the fill the active selection area bounds. and aligned to the selection center. The layer mask is added and by default is linked to the layer content. However, Frames should not move but the image with should be transformable so its composition can be tweaked. So my action manager code add the layer mask then unlinks the mask. Noting is passed to the action manager function. It always add the active selection to the active layer as a layer mask and then unlinks the mask from the active layer content. Action manager code produced by the Scriptlistener Plugin is not a thing of beauty.
// =======Un linked layer Mask========================================
function layerMask() {
var idMk = charIDToTypeID( "Mk " );
var desc3 = new ActionDescriptor();
var idNw = charIDToTypeID( "Nw " );
var idChnl = charIDToTypeID( "Chnl" );
desc3.putClass( idNw, idChnl );
var idAt = charIDToTypeID( "At " );
var ref3 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
var idChnl = charIDToTypeID( "Chnl" );
var idMsk = charIDToTypeID( "Msk " );
ref3.putEnumerated( idChnl, idChnl, idMsk );
desc3.putReference( idAt, ref3 );
var idUsng = charIDToTypeID( "Usng" );
var idUsrM = charIDToTypeID( "UsrM" );
var idRvlS = charIDToTypeID( "RvlS" );
desc3.putEnumerated( idUsng, idUsrM, idRvlS );
executeAction( idMk, desc3, DialogModes.NO );
// =======================================================
var idsetd = charIDToTypeID( "setd" );
var desc2 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref1.putEnumerated( idLyr, idOrdn, idTrgt );
desc2.putReference( idnull, ref1 );
var idT = charIDToTypeID( "T " );
var desc3 = new ActionDescriptor();
var idUsrs = charIDToTypeID( "Usrs" );
desc3.putBoolean( idUsrs, false );
var idLyr = charIDToTypeID( "Lyr " );
desc2.putObject( idT, idLyr, desc3 );
executeAction( idsetd, desc2, DialogModes.NO );
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now