In ports and pins set Output1,2,3,4 to the port and pin for your motor signals.
Use some of Mach3's M codes e.g. M3, M4, M8, M9, modify the macro in the VB editor to ActivateSignal(Input1) and DeActivateSignal(Input1)
For example :-
'M3 macro
ActivateSignal(Output1)
sleep 100
code "G4 P1000" ' wait 1 second
sleep 1000
while ismoving()
wend
DeActivateSignal(Output1)
sleep 100
Just do this for each M code and save them back changing the Output1 to whichever one you are using.
This may not be perfect but its a starting point.
Graham