this is my vb may be i have some thing wrong on this
Sub Main()
z= GetUserDro(1202)
code"G53 G0z"&z
While IsMoving()
wend
NewTool = GetSelectedTool()
OldTool = GetCurrentTool()
MaxToolNum = 16 'Max number of tools for the changer
While NewTool > MaxToolNum
NewTool = Question ("Enter New Tool Number up to " & MaxToolNum)
Wend
If NewTool = OldTool Or NewTool = 0 Then
Exit Sub
End If
If OldTool <> NewTool Then
SetUserDRO(2000, NewTool)
End If
SystemWaitFor (INPUT4) 'when the PLC is done, it can turn on input4 so the M6 will drop out.
SetOEMDRO(824,NewTool)
While IsMoving
Wend
End Sub
Main