Smoothvalue Control

Hi all folks,
i'd need a help to create a "SmoothValue Controller".
I want to connect the ".division" attribute of the selected objects' polySmoothFace node to a slider.
I wrote this:

spaceLocator -p 0 0 0 -n smoothCtrl;
addAttr -ln smoothValue -at long -min 0 -max 3 -dv 1 |smoothCtrl;
setAttr -e -keyable true |smoothCtrl.smoothValue;

string $obj[] = ls -et "polySmoothFace";

for ($node in $obj)
{
string $smooth = $node+ ".divisions";
connectAttr smoothCtrl.smoothValue $smooth;

but it works only on all objects on the scene. What I need is to add some little code to perform the connection on selected objects only.

Thanks in advance for the help,
Vincenzo

Hi there, i solved the problem by adding a "-listConnections" command to make a list of objects in my selection that have the node "polySmoothFace":

//here I create a control object
spaceLocator -p 0 0 0 -n smoothCtrl;
addAttr -ln smoothValue -at long -min 0 -max 3 -dv 1 |smoothCtrl;
setAttr -e -keyable true |smoothCtrl.smoothValue;

//here I select the shapes, that may have connections to polySmoothFace node
select -hi;

//here I create the list of objects in my selection that have polySmoothFace connections
string $sel[] = ls -sl;
string $conn[] = listConnections -t polySmoothFace $sel;
print $conn;

//Here I connect the control object to every divisionValue of the poly smoothed objects
for ($node in $conn)
{
string $smooth = $node+ ".divisions";
connectAttr smoothCtrl.smoothValue $smooth;

};

hope this can help
Vincenzo