Here is the javascript version.
function loadLayerTransparencyToSelection() { var desc = new ActionDescriptor(); var ref = new ActionReference(); ref.putProperty( charIDToTypeID('Chnl'), charIDToTypeID('fsel') ); desc.putReference( charIDToTypeID('null'), ref ); var ref = new ActionReference(); ref.putEnumerated( charIDToTypeID('Chnl'), charIDToTypeID('Chnl'), charIDToTypeID('Trsp') ); desc.putReference( charIDToTypeID('T '), ref ); executeAction( charIDToTypeID('setd'), desc, DialogModes.NO );
};