Is there any way to set a timeout threshold for, let's say 90 seconds, and then when that 90 seconds is up, transfer control to an event handler? Kind of like the OnEvent, but time-based?
I was thinking that would be a way to see if I've gotten stuck somewhere with some unanticipated condition I haven't handled.
Time-based Event?
Moderators: Dorian (MJT support), JRL
Re: Time-based Event?
Perhaps a custom OnEvent> timer? This counts for ten seconds then the result subroutine resets everything to start counting for another ten seconds and so on. All very pointless but time is handled.
Code: Select all
Let>TimePeriod=10
Timer>StartTime
OnEvent>Custom,EventTimer,TimedOut,ResultEvent
Message>
Let>Count=0
Label>Loop
Wait>0.1
Add>Count,1
SetControlText>Macro Scheduler Message,TMemo,1,Count
Goto>Loop
SRT>EventTimer
Timer>EndTime
Let>TotalTime={(%EndTime%-%StartTime%)/1000}
If>%TotalTime%>%TimePeriod%
Let>TimedOut=True
EndIf
END>EventTimer
SRT>ResultEvent
Let>TimedOut=
MDL>We reached %count% in %TimePeriod% seconds
Let>Count=0
Timer>StartTime
Message>
END>ResultEvent
Re: Time-based Event?
Hmmm... maybe, although I wonder what that'd do to performance if, as the docs describe, it executes continuously. Does it allow the rest of the program to run?
Re: Time-based Event?
OnEvent>s, used prudently, hardly have any effect on performance. You want to keep custom event test subroutines as small as possible and you don't want to test for a lot of different files or windows with the FILE_EXISTS or WINDOW_OPEN event handlers. But... this particular OnEvent is not likely to be noticeable
Re: Time-based Event?
Thanks! I will give it a shot.