Thanks for the try, but it still gave me the alarm.
Also, as far as making the code simple, I made a mistake when I said that your simplified code was doing what I wanted it to do. I didn't test it enough. I want the stop switch to keep the program from running, and to stop it if it is already running. To do that, I think I need the and2's and or2's. This stop switch is actually a switch to tell the machine if a part is loaded. The machine glues and UV cures parts, and I dont want it to run if there is no part loaded or if the operator decides to pull it out.
I tried adding the "setp halui.mode.teleop 1" to my more complicated code. It didn't prevent the error message, but I may need to add it into the logic and not just on its own line?
Also, my code stops the program but when you hit restart, it goes to the previous line in the g code. I would like it to re-start from the beginning of the program. This is something else that I missed due to running an extremely short test program. Is there a way to force it to restart from the beginning?