I had a similar problem and solved it inside the macro m6start.m1s
There is an auto tool probing script which i modified.
If you use a similar script, find the lines that set the Z offset.
in my script that is accompished by calling:
Call SetOEMDRO (802, probeThickness)
probe thickness is to compensate the height of the touchoff tool i use
so the command Call SetOEMDRO (46, 1)
changes current work offset
1 is G54 up to 6, G59
Write a for loop as follows
CurrentWorkOffsetNumber = GetOemDRO(46)
For workOffsetNumber = 1 To 6
Call SetOEMDRO (46, i)
Call SetOEMDRO (802, probeThickness)
Next
Call SetOEMDRO (46, CurrentWorkOffsetNumber)
first and last lines ensure Mach3 is back to work offset you are at
Hope that helps