If it is possible there is a way to see if a selection is present or not
I wish that the script needs to do this work:
if the selection and this has to start an action
if not, and this has to publish a notice that the selection is not present.
////// check for selection //////
var ref10 = new ActionReference();
ref10.putEnumerated( charIDToTypeID( "Dcmn" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
var docDesc = executeActionGet(ref10);