Was trying to figure out exactly this just yesterday. From pouring over the documentation I concluded that you have 2 basic options:
Create an action in Photoshop that simply does the selection and invoke it from your script using
app.doAction([actionName], [actionSetName])
.Use the script listener plugin to extract your own function to do the selection and use that directly in your script.
Option 1 seems a little "safer", but it does introduce a dependency on having an action with a specific name and function presently loaded in PS; which is the suck.
Option 2 is a bit harder to maintain, but it encapsulates all dependencies within itself rather nicely. If you want to go with that then try adding and invoking this function in your script (slightly cleaner version of what you'd get from the script listener):
function SelectTransparency()
{
var idChnl = charIDToTypeID( "Chnl" );
var actionSelect = new ActionReference();
actionSelect.putProperty( idChnl, charIDToTypeID( "fsel" ) );
var actionTransparent = new ActionReference();
actionTransparent.putEnumerated( idChnl, idChnl, charIDToTypeID( "Trsp" ) );
var actionDesc = new ActionDescriptor();
actionDesc.putReference( charIDToTypeID( "null" ), actionSelect );
actionDesc.putReference( charIDToTypeID( "T " ), actionTransparent );
executeAction( charIDToTypeID( "setd" ), actionDesc, DialogModes.NO );
}
Just make sure you have the desired document and a valid layer active before calling the method. Hope it helps.