I may have not said it clearly enough.
your code is doing something all the time:
Code:

While $frmForm.visible
$= Execute($frmForm.doevents())
Loop


this part of code above makes your script loop inside the while-loop as long as the form is visible.
so, it does do something, it loops. just as you asked it to, with the code.