ok try this it is a combination of Brains, the macropump and your custom macro.
Put the following in the Macro pump and the other part in your M555, then turn on macro pump and reboot mach.
'Macro Pump
If GetUserLED(2001) Then
Message("Z in position for tool change")
SetUserLED(2000,0)
SetUserLED(2001,0)
end If
If GetUserLED(2002) Then
Message("ERROR - Switch is not triggered")
SetUserLED(2002,0)
SetUserLED(2003,0)
end If
'This next stuff goes in your M555.
'M555 here is your intiating macro (or you can use M6)
SetUserLED(2000,1)
SetUserLED(2003,1)
code "G01 G53 Z201 F1000" 'this moves in Machine coordinates
While IsMoving()
WEnd
Download the brain zip file and unzip, put it in your brain folder, from within mach, goto operator, goto brain control and enable the brain called. ATC_Zaxis.brn, hit the view button and then test your system by loading the M555 in your MDI line.
give us feedback.
scott