In general, you can use ls -sl for getting the names of currently selected nodes.
You can use the listRelatives command to get the names of all the shape nodes that are hierarchically below (that is, child nodes) the currently selected nodes. For example:
string $obj[] = `ls -sl`; listRelatives -s $obj;