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_send_string("popup YOURMESSAGE!","internal")

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