Fnykis
6/30/2017 - 9:37 AM

Create layer mask from selection

Create layer mask from selection

function makeLayerMask() { // Creates a layer mask on the activeLayer from current selection
	var maskType = 'RvlS' ; //from selection
	var desc140 = new ActionDescriptor();
	desc140.putClass( charIDToTypeID('Nw  '), charIDToTypeID('Chnl') );
		var ref51 = new ActionReference();
		ref51.putEnumerated( charIDToTypeID('Chnl'), charIDToTypeID('Chnl'), charIDToTypeID('Msk ') );
	desc140.putReference( charIDToTypeID('At  '), ref51 );
	desc140.putEnumerated( charIDToTypeID('Usng'), charIDToTypeID('UsrM'), charIDToTypeID(maskType) );
	executeAction( charIDToTypeID('Mk  '), desc140, DialogModes.NO );
}