Forum Discussion
Can you post the code you're using?
Also... why not use NameMapping? Honestly, seems like re-inventing the wheel.
- maxtester8 years agoContributor
The code that I' using.
The object that I want to wait for is for example a gui- object:
CheckIfApplicationStarted("AWTComponentName","Whatever",Sys.Process("java").SwingObject.AndSoOn.AndSoOn)function CheckIfApplicationStarted(str_PropertyName,str_PropertyValue,obj_BaseObject,int_TimeoutInSeconds){ try{ var obj_Result = Utils.CreateStubObject(); var int_TimeoutForRetrys = 10 if(int_TimeoutInSeconds != undefined){ int_TimeoutForRetrys = int_TimeoutInSeconds } for(var i = 0 ; i< int_TimeoutForRetrys; i++){ obj_BaseObject.Refresh() obj_Result = FindObjectInBaseObject(str_PropertyName,str_PropertyValue,obj_BaseObject,2) if(obj_Result.Exists){ Log.Message("Propertyvalue '" +str_PropertyValue+ "' for property in object '" +str_PropertyName+ "' found") return obj_Result } else{ Log.Message("Wait for object...") } Delay(1000) } return obj_Result } catch(e){ Log.Error("Error while check property: " +e.message) } }function FindObjectInBaseObject(str_PropertyName,str_PropertyValue,obj_BaseObject,int_Depth){ var obj = Utils.CreateStubObject(); var int_SearchDepth = 50 if(int_Depth != undefined){ int_SearchDepth = int_Depth } try{ if(str_PropertyName === undefined || str_PropertyValue === undefined){ Log.Message("No property value or propertyname passed") return obj } var obj = obj_BaseObject.Find(str_PropertyName,str_PropertyValue,int_SearchDepth) if(obj.Exists){ Log.Message("Found object: " +obj.Name) } else{ Log.Message("No object found with the propertyname '" +str_PropertyName+ " and the property value '" +str_PropertyValue+ "'") } } catch(e){ Log.Error("Error while trying to find object: " +e.Message) } return obj } - maxtester8 years agoContributor
I don't want to use NameMapping anymore. I have about 7 Projects in my ProjectSuit and the NameMapping becomes bigger and bigger. We have aklready about 2000 objects and in some cases a performance issue. It's not like re-inventig the wheel but using another method
- tristaanogre8 years agoEsteemed Contributor
Have you looked into using the "WaitProperty" method? Once you find the object and verify it exists, you can use WaitProperty method on that object to wait for a property of the object to match an indicated value.
- maxtester8 years agoContributor
I use the waitproperty in my project. But this is still the same prblem. When I pass an 'Alias' everything is fine. As soon as I use the FullPath the object does not refresh in another function.