Hello Guest it is April 18, 2024, 04:01:56 PM

Author Topic: How can I detect in VB if Mach3 is stopped?  (Read 2427 times)

0 Members and 1 Guest are viewing this topic.

How can I detect in VB if Mach3 is stopped?
« on: December 11, 2016, 03:27:40 PM »
I'm creating VB scripts which I'm running using the Mach3 VB script editor.

If I click on the big red "Reset" button in Mach3 while having a VB script running, the script immediately stops, but as soon as I click the "Reset" button again, the script starts running again. And as long as the script is running, it is impossible to stop it with Mach3 VB script editor. This is a BIG problem for me for two reason:

1) If an error occurs, for example if I need to emergency stop the machine, I click on the "Reset" button and the machine stops. But to correct the problem I need to run Mach3 manually and to do that I need to click on the "Reset" button again and then the VB program starts again, leading to an even bigger problem.

2) My programs take a very long time to run, for example doing a probe may take an hour. So I need to be able to start the program and let it run a short while to test it, and then I need to be able to interrupt it to change the program. But I haven't found a way yet to interrupt a running VB script.

I tried the IsEStop() function inside every loop in the program, but it doesn't stop the program. I have the code:

If IsEStop() Then
    Stop
End If

But this code doesn't stop the program when I click on the "Reset" button.

Best regards,
Daniel