Is there a simpel way to return to the beginning off the program, i have a check in the middle of the program, after the check is done have inserted a pop-up, when the user presses continue the program sould return to the beginning en restart
Not sure if the best way to do it, but you could insert your code in a < Loop > node that monitors an exit variable as its looping condition such as the below image. Doing this will cause the cursor not to follow the execution of your code.
Alternatively, there is this < break > node available or you can probably create your own script to do this also.
For any loop/if statement that is checked continuously, if there is any robot motion within the statement, the first command after the loop/if needs to be a stopj() or stopl() script command. This allows the robot to properly stop its previous motion before executing new motion. Without this, you are likely to see protective stops.
Further explanation of the stopj() and stopl() commands can be found in the script manual.