I haven't seen this question asked - there's no script command that I can see to do this either: Is there a way to determine which units (under your command) have been selected? If this was possible, I could make custom commands you could issue to particular units (or groups)
I just thought, if this isn't possible then I was thinking of making use of the addaction command to create a dynamic "menu" of sorts to run more advanced scripted commands - For example "select solder.." would create action items for each soldier under your command, "Fred..." "Barney..." etc., choosing one of those would present a list of scripts you could apply to that person like "Continue with mission objective" "Plant mines here" etc. What does everyone think about this idea? Do you think you'd use it?