The only way I've found is using the onMapSingleClick function, which gives you the _units array of selected units.
To see a working example, check out kmkSquadStuff2, "actBaseOfFireInit2.sqs".
I copy the _units array and store the copy in a global array for later use.
If there is an easier way to get a user-defined unit array, I'd love to know. I really want script access to the player-defined teams within the group...that would open up lots of possibilities.