first create new float attributes for that object (I use "pCube1" in this case)
for example "localX", "localY", "localZ" _and_ "dummy";
and then add this expression to the "dummy" attribute:
//**********************************
pCube1.dummy = pCube1.localTrX + pCube1.localTrY + pCube1.localTrZ;
move -a -os -x getAttr pCube1.localTrX
;
move -a -os -y getAttr pCube1.localTrY
;
move -a -os -z getAttr pCube1.localTrZ
;
//**********************************
the dummy-attribute is just a trick to force maya to execute the mel-lines when you change a localXYZ attribute.
If you want to do the same with rotation you have to use the "rotate" command instead of "move", or you could use "xform" for both.
hope this helps