Give this a whirl, there are MANY ways to do this .This is just a replication of how you described the motion.
Dobutton(22) 'RefX
While Ismoving()
Wend
SetDro(0,0)
DoButton(23) 'RefY
While Ismoving()
Wend
SetDro(1,0)
Code"G0 X4 Y4" 'move to new location
While Ismoving()
Wend
SetDro(0,0)
SetDro(1,0)
END