Snapping curve point to object

I need to have curve points snap to various objects and I have this script which sort of works but I need for the script to update when I am moving the object in realtime. Currently this script only works when you hit edit, load the project or advance the timeline. I think there is an obvious solution but I'm missing it.

xform -worldSpace -translation (nurbsSphere1.translateX) (nurbsSphere1.translateY) (nurbsSphere1.translateZ) curve1.cv[2];

Nevermind... here's the solution

curveShape2.controlPoints[1].xValue =nurbsSphere1.translateX;
curveShape2.controlPoints[1].yValue =nurbsSphere1.translateY;
curveShape2.controlPoints[1].zValue =nurbsSphere1.translateZ;

Doesn't this just work with the objects' center point? Is there a way to make this work on a poly face?

-bN

Maya doesn't use the object's pivot for components.. when you select a group of CV's or faces it creats a pivot base dont heir bounding box rather than use the object's pivot.