scrier
14 years agoContributor
Wait for a region.compare to occur with max time.
Is there some way to get the current time as Unix time from any of the variables. I want to write a method to check for a region to occur during a specified time window. The aqDateTime dowsn't seem to support this function. And the Regions.Compare doesn't seem to support a timeout.
function waitUntilImageIsInStateA(maxTimeInSeconds) {
var TimeNow = aqDateTime.now();
var maxTime = TimeNow + maxTimeInSeconds;
while( maxTime > TimeNow ) {
if( Regions.Compare("Image" Aliases.QObject.lblNavigation, false, false, true, 0, lmNone ) {
Log.Message(":: TEST :: State A Occured after " + aqDateTime.now() - TimeNow + " seconds.");
return true;
}
}
Log.Warning("Timeout occured waiting for Checkpoint");
return false;
}
The following code executes but does not work as I would like, the variable added is as far as I know not in seconds, maybe milliseconds as it seems to be around 5 seconds it's waiting. Although the Regions.Compare does occur but does not triggere the method successully.
function waitUntilImageIsInStateA(maxTimeInSeconds) {
var TimeNow = aqDateTime.now();
var maxTime = TimeNow + maxTimeInSeconds;
while( maxTime > TimeNow ) {
if( Regions.Compare("Image" Aliases.QObject.lblNavigation, false, false, true, 0, lmNone ) {
Log.Message(":: TEST :: State A Occured after " + aqDateTime.now() - TimeNow + " seconds.");
return true;
}
}
Log.Warning("Timeout occured waiting for Checkpoint");
return false;
}
The following code executes but does not work as I would like, the variable added is as far as I know not in seconds, maybe milliseconds as it seems to be around 5 seconds it's waiting. Although the Regions.Compare does occur but does not triggere the method successully.