I have got it to work by doing the following.
I am using m6 tool change to read an OEM dro, add something to it and set the OEM dro after every move and then Sets m1 that pauses the application. I have modified the screen to show the OEM dro which gets updated after every move. In Autoit I am using the pixcelcheksum function that looks for change in a specific coordinates of the screen to trigger the next action.
M6
x = getUserDRO(1200)
If x > 100 Then x=0:setUserDRO(1200, x)
x=x+11.1111
While IsMoving()
Wend
setUserDRO(1200, x)
code" m1"
The sequence is
1. autoit loads the gcode file in mach3
2. autoit triggers cycle start in Mach3 and runs the pixelcheksum function.
3. mach3 runs the first gcode line and the next line is always m6.
4. When the DRO change is seen due to change in the pixels autoit triggers another software to do its thing.
5. The process is then repeated as necessary.
The mach3 window must always be sized properly and be on top for this to work but so far it looks very promising.
For those interested, I am using this to control a 3d full body scanner. Mach3 runs the up/down, tilt and rotary table and another software controls the scanning. By controlling the entire process automatically with autoit, a full body scan can be done with one key stroke.
You can see the working of the scanner at
https://www.youtube.com/watch?v=DqXBjfkeJwE