Forum Discussion
Abramova
Staff
14 years agoHi,
You can also use methods of the HISUtils.StopWatch program object to check for a region checkpoint to pass during the specified time interval. This allows you to calculate how long the verification takes up to milliseconds.
function waitUntilImageIsInStateA(maxTimeInSeconds)
{
var TimeNow = aqDateTime.now();
var maxTime = aqDateTime.AddSeconds(TimeNow,maxTimeInSeconds)
var StopWatchObj = HISUtils.StopWatch;
StopWatchObj.Start();
while(maxTime > TimeNow)
{
if( Regions.Compare("Image", Aliases.QObject.lblNavigation, false, false, true, 0, lmNone ) )
{
StopWatchObj.Stop();
Log.Message("Checkpoint passed. Execution time: " + StopWatchObj.ToString());
return true;
}
else
{
Log.Warning("Checkpoint failed or timeout elapsed while waiting for the checkpoint");
return false;
}
}
}