Hi Tom,
What you need is a non existant object. Just create one this way:
var returnObject = new Object();
returnObject.Exists = false; // Just to make sure
If I understood correctly, you are just waiting for an object to exist. I rewrited a bit your code, check if you can use it for your needs:
function LocateObjectByProps(basePath, propArray, valuesArray)
{
var returnObject = new Object(); returnObject.Exists = false;
var wait = 1000; // Whatever you need
try {
// This will create a folder, so all searches won't mess the log
Log.AppendFolder("LocateObject reached");
while ( !returnObject.Exists && i < 100 ) {
Delay(wait);
returnObject = basePath.Find(propArray, valuesArray, 1000);
i++;
}
} catch ( e ) {
Log.Warning("Exception: " + e.description);
} finally {
Log.PopLogFolder();
if ( !returnObject.Exists ) Log.Error("Unable to locate object by its properties", valuesArray);
return returnObject;
}
}
I haven't tested it, but I think it will work. Check my blog for some advanced search functions.
I hope it helped!