I spent alot of time trying to find a solution to automatically turning on a dust extractor, water pump or a vacuum board and everything I found was to use the flood button and to add the m8 into the gcode file.
That was all just to painfull adding to every gcode file.
all you need to do is add ActivateSignal(OutPut1) to m3 macro file and DeActivateSignal(OutPut1) to m5 macro file
eg. M3 macro
DoSpinCW()
ActivateSignal(OutPut1)
M5
DoSpinStop()
DeActivateSignal(OutPut1)
this will turn on and off output 1 with the spindle motor automatically
the only change you need to make is to change the output number to suit your setup eg. ActivateSignal(OutPut2) , DeActivateSignal(OutPut2)
the location of the macro file is C:\Mach3\macros\Mach3Mill