your mixing mach3 code with mach4 code for one thing
cool now your doing the counting in the gcode and is fine but you dont need the m code now you can use the plc script to update the DRO
but to set a screen =scr control you have to use the mach4 command
practice and read, read, read everything, there is so much to learn and explore.
this is closer to what you need.
scr.SetProperty(dro1501, 'Value', tostring(counter));
did the history box update with the correct value?
Note: Surprised no one noticed/commented that the pound variable "500" is not an ireg variable

(Kind of my way to test observers)
