No dont use a scriptjob for this. Its the sort of thing that appears to work but cause s a lot of havoc on maya. (in general if you use scriptjobs then your 90% of the time doing it worng and the 10% of time its the only way, but most suers cant spot the 90 form the 10)
First it has a problem with event explosion, which can send maya into a indefinite loop if not carefully orchestrated. Secondly it keeps building a lot of stuff in your undo queue that can choke maya and make undoing impossible (this si not very desireable effect). This dont wont wok if you use a interactive playback. Fourth it don't keep with the scene, whena it does it relies on unchanging names of nodes.
Now most of these things can be worked out, but form a pure philosophical point of view its like fighting windmills as every single time you do something you keep fighting against mayas core philosophy.
As last it slows things down a lot. In general you should allways be VERY carefull when working with changing selections in mel. As aa rule of thumb you sould never change selection in a script unless your presenting something to the user. If you must use zoo trigger for this but in ganral this kind of redirection si not nearly as a good idea as it sounds.
But again the preffered method is this (for some reason very unused method):
CODE
file -f -new;
sphere -p 0 0 0 -ax 0 1 0 -ssw 0 -esw 360
-r 1 -d 3 -ut 0 -tol 0.01 -s 8 -nsp 4 -ch 1;
sphere -p 0 0 0 -ax 0 1 0 -ssw 0 -esw 360
-r 1 -d 3 -ut 0 -tol 0.01 -s 8 -nsp 4 -ch 1;
move -r -os -wd 2.681036 0 0;
select -r nurbsSphere1 nurbsSphere2;
group;
setAttr "group1.displayHandle" 1;
setAttr "group1.overrideEnabled" 1;
setAttr "group1.overrideColor " 13;
Now make the view shaded notice how theres red tick in middle. Its there so you can select the group. But it also doesnt stop you form selecting the individual enements at the same time (if you marquee select it will prefeer the group over the individual objects.)
Yes even one sphere in above example form previous post can be still wile other allways moves. for example:
CODE
file -f -new;
sphere -p 0 0 0 -ax 0 1 0 -ssw 0 -esw 360
-r 1 -d 3 -ut 0 -tol 0.01 -s 8 -nsp 4 -ch 1;
sphere -p 0 0 0 -ax 0 1 0 -ssw 0 -esw 360
-r 1 -d 3 -ut 0 -tol 0.01 -s 8 -nsp 4 -ch 1;
move -r -os -wd 2.681036 0 0 nurbsSphere1.cv[0:6][0:7];
parent -add -shape nurbsSphereShape2 nurbsSphere1;
delete nurbsSphere2;
createNode transformGeometry;
connectAttr -f makeNurbSphere1.outputSurface
transformGeometry1.inputGeometry;
connectAttr -f transformGeometry1.outputGeometry
nurbsSphereShape1.create;
connectAttr -f nurbsSphere1.worldInverseMatrix[0]
transformGeometry1.transform;
Now this bring you to a yber method wich can meake you do whatever you want. without needing to resort to scriptjobs. Indeed you can even have all joints invisible and select areas in a continious mesh with this method and see the deformations on those sections if you wish.
Now thsi methodology is persistent and leverages mayas dg to do the job right at all times.
Theres unlimitted variations to thsi such as linking the object to the camera for selection shortcuts etc.