OnEvent should disable event handler until SRT finished.

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

OnEvent should disable event handler until SRT finished.

Post by gdyvig » Fri Feb 27, 2009 3:00 am

OnEvent calls a SRT. While in the SRT OnEvent is disabled while event is logged and handled, when the SRT is finished OnEvent is enabled again for the next event. That is how it should work.

However, if the OnEvent SRT does a GoSub>AnotherSRT, OnEvent is immediately re-enabled. This is incorrect. In the case of a WINDOW_OPEN event the OnEvent SRT will be called repeatedly before the original instance has returned from AnotherSRT.

The OnEvent should remain disabled until the original SRT has finished or does an unconditional GoTo to a label outside the original SRT.

This defect may not be noticed for instantaneous events such as key press or Window_CLOSE events.

In the example below, SRT>HandleError is never called.

OnEvent>WINDOW_OPEN,Error*,2,ProcessError,Error*

SRT>ProcessError
GoSub>LogError,%ProcessError_Var_1%
GoSub>HandleError,%ProcessError_Var_1%
END>ProcessError

SRT>LogError
//Code to Capture image/OCR, log to result file
END>LogError

SRT>HandleError
//Code to close the window
END>HandleError


Gale

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts