just one shot in the dark without seeing the complete script...

try to replace
$=Execute($Form.DoEvents())

with
$=Execute($Form.DoEvents(1))
at this place.. the 1 is optional for NoWait.

The best practice is to use the Form event handling in just one place, right between making your Form visible and the end of the script like
 Code:
$Form.Visible
while $Form.Visible
    $ = execute($Form.DoEvents)
loop
exit 1


If you cannot do this, eg. preventing the form to freeze while doing other things, use the central loop without NoWait, and all the other places with the NoWait option.


Edited by Jochen (2017-01-16 11:46 AM)
_________________________