Thanks. My script looks the same. On my system, when the Gcode is finished, it is rewound and the cycle time is changed to 00:00:00.0.
I played around with it today. What I ended up doing is a little crude, but it is working. In the PLC script, I check to see if the MachEnable variable has changed value. I added a text box called TonyTime. If the MachEnable is 1 and the value of the CycleTime label is NOT 00.:00:00.0, then I set the Label of TonyTime to the same as the CycleTime Label value (I use a variable). I then added a button that resets TonyTime to 00... Seems to work.
I looked at my Gcode files. I use Vcarve Pro, btw. There is an M30 at the end which I think does the End and rewind?
Sorry, I don't have the code on this PC. Its on the laptop in the shop.
Tony