// MAKE SELECTION FROM LAYER MASK
function selectMask() {
try{
var desc004 = new ActionDescriptor();
var ref004 = new ActionReference();
ref004.putProperty( charIDToTypeID( "Chnl" ), charIDToTypeID( "fsel" ) );
desc004.putReference( charIDToTypeID( "null" ), ref004 );
var ref005 = new ActionReference();
ref005.putEnumerated( charIDToTypeID( "Chnl" ), charIDToTypeID( "Chnl" ), charIDToTypeID( "Msk " ) );
desc004.putReference( charIDToTypeID( "T " ), ref005 );
executeAction( charIDToTypeID( "setd" ), desc004, DialogModes.NO );
} catch(e) {}
}