Forum Discussion
Colin_McCrae
11 years agoCommunity Hero
I don't know what language you're using. So, using pseudo-language, I do something like this:
I Pass in ....
WaitTime = x
MaxNumberOfAttempts = y
ObjectToFind = <OBJECT>
Function WaitForObject(WaitTime, MaxNumberOfAttempts, ObjectToFind)
Attempts = 0
StartTime = Timer
Do
check = Does ObjectToFind Exist ?
If check is FALSE Then
Attempts = Attempts + 1
End If
Loop Until (check is TRUE) or (Attempts = MaxNumberOfAttempts) or (Timer-StartTime > WaitTime)
Determine which condition was met and update return info.
End Function
Pass in the object you want to wait for, how many attempts it is allowed, and how long you are prepared to wait. The function does the rest and passes back a true or a false (or more info if you want) depending on the condition that caused it to exit the loop.
I Pass in ....
WaitTime = x
MaxNumberOfAttempts = y
ObjectToFind = <OBJECT>
Function WaitForObject(WaitTime, MaxNumberOfAttempts, ObjectToFind)
Attempts = 0
StartTime = Timer
Do
check = Does ObjectToFind Exist ?
If check is FALSE Then
Attempts = Attempts + 1
End If
Loop Until (check is TRUE) or (Attempts = MaxNumberOfAttempts) or (Timer-StartTime > WaitTime)
Determine which condition was met and update return info.
End Function
Pass in the object you want to wait for, how many attempts it is allowed, and how long you are prepared to wait. The function does the rest and passes back a true or a false (or more info if you want) depending on the condition that caused it to exit the loop.