No need, gotta love Mach and VB
Here is my button script, no need for a macro as all the macro script can be run direct thus...
Dim Msg, Style, Title, Response
If GetOEMLed(804)<>0 Then Exit Sub'make sure code is not running
Msg = "Please Remove The Torch And Move Z To A Safe Height" 'Define message.
Style = 1 + 64 + 256 'Define buttons.'Style = vbokcancel + vbinformation + vbDefaultButton2 buttons.
Title = "Torch Consumable Change" 'Define title.
Response = MsgBox(Msg, Style, Title) 'Display message.
If Response = 1 Then
Code "G91" 'switch To incremental mode
Code "G00 X22.00" 'position probe switch
Code "G90" 'switch To absolute mode
ActivateSignal(OutPut3) 'triggers the probe cylinder
Code "G28.1 Z10.000" 'probe the surface
Code "G92 Z#15045" 'apply the probe switch offset from settings screen DRO
DeActivateSignal(OutPut3) 'raise the probe
Sleep(200)
Code "G91" 'switch To incremental mode
Code "G00 X-22.00" 'put the axes back To where we came from
Code "G90" 'switch To absolute mode
Code "G00 Z0.00"
Msg = "Replace Torch After Changing Consumables" 'Define message.
Style = 0 + 64 + 0 'Define buttons.'Style = vbokonly + vbinformation + vbDefaultButton1 button
Title = "Torch Consumable Change" 'Define title.
Response = MsgBox(Msg, Style, Title) 'Display message.
Code "G00 Z1.00"'raise torch to 1mm
Msg = "Verify Calibration With 1mm Feeler Gauge" 'Define message.
Response = MsgBox(Msg, Style, Title) 'Display message.
Code "G00 Z20.00"'raise torch to safe height ready for work
End If
The need for this is due to my "after-market" IHS probe method, as the probe is not done by the actual torch now, any change in torch position - new consumables, switching to the 30A unshielded from 45A shielded parts etc, upsets the reference between torch nozzle and probe switch - the "switch offset".
My little script here prompts me to remove the torch, runs a IHS sequence against a heavy reference plate (a 3" disc of steel I have), parks the Z axis at Z0.00 then prompts me to replace the torch after fitting new parts etc, the torch is clamped up with the nozzle touching the reference plate. It then moves to Z1.00 so I can verify the setting with a feeler gauge if wanted then it moves to my safe-Z height.
Sounds complex, takes seconds and i get super accurate IHS and another useful button on my screen
I do a lot of VB6 programming at work and this version of VB is very close so it's fun to mess with.