You should be able to do it with some VB and a user dro, if you add a few lines to the M3, M4 & M5 macros.
In the M5 macro add something like this
Call SetUserDRO(Number, 0)
DoSpinStop()
In M3 put something like
dir=GetUserDRO(Number)
if dir = 0 then
DoSpinCW()
Call SetUserDRO(Number, 3)
else
generate an error message and stop the machine
endif
In M4 put something like this
dir=GetUserDRO(Number)
if dir = 0 then
DoSpinCCW()
Call SetUserDRO(Number, 4)
else
generate an error message and stop the machine
endif
Not sure it will work, as I have not tried it, maybe Brian will correct my errors.
Graham.