Universal Robots Forum

Script code to end/stop the entire program

I’m trying to find a script code/command where once it is executed, the entire program is terminated, regardless of whether it is in a sub function or part of a loop. And one that doesn’t use the “Stop program / cancel” of a popup message.

For example, if the program detects that a particular variable is out of range, the preferred action is to show a popup “Input is unreasonably large. Program has been terminated.”. And that the program has been actually terminated. (not referring to a situation where the operator has to push the stop program or cancel button).

Is there a code that will do this?

The closest i can think of are the blocking features of the popups, but that is not what i am looking for.

To immediately stop the program, I would use popup with blocking=False and put halt directly after it. You get a popup and stop the program at the same time.
That is what Polyscope does when you tick “Halt program execution at this popup”.

Hi, Maybe you can use the Dashboard Server…something like a thread with

If yourVar > x then
socket_open("127.0.0.1",29999,"internal")
socket_send_string("popup YOURMESSAGE!","internal")
socket_send_byte(10,"internal")
Sleep(0.5)
socket_send_string("stop","internal")
socket_send_byte(10,"internal")
2 Likes

thank you very much. this was the solution that worked best for me indeed.