ArmandsBruns
12 years agoFrequent Contributor
Function (Find Object in NameMapping)
Hi,
I have function:
This function works fine the only problem is the log error.
If there are many objects with the same values (typeID and name), then click on them and then displays an error that the object is out of the window size.
Maybe I can use adisional 'VisibleOnScreen = True Then object(i).Click'
------------------------------------------------
Function IfObjectExists(location, typeID, name)
IfObjectExists = False
Sys.Refresh()
location.RefreshMappingInfo
Do
counter = counter + 1
Sys.Refresh()
location.RefreshMappingInfo
If(location.FindChild( typeID, name,30).Exists <> Empty ) Then
IfObjectExists = True
log.Message("Find this object - '"+typeID+"', '"+name+"' - and click!")
object = location.FindAllChildren(typeID, name, 20000, True)
For i = 0 to UBound(object)
If object(i).Exists Then object(i).Click
Next
Log.Message "Find: " & (UBound(object) + 1)
Call location.Wait
Else
IfObjectExists = False
aqUtils.Delay(2000)
Sys.Refresh()
location.RefreshMappingInfo
log.Message ("Doesn't find this objects: '"+typeID+"', '"+name+"'")
End If
Loop Until IfObjectExists = True or counter > 25
End Function
------------------------------------------------
Regards
Armands
I have function:
This function works fine the only problem is the log error.
If there are many objects with the same values (typeID and name), then click on them and then displays an error that the object is out of the window size.
Maybe I can use adisional 'VisibleOnScreen = True Then object(i).Click'
------------------------------------------------
Function IfObjectExists(location, typeID, name)
IfObjectExists = False
Sys.Refresh()
location.RefreshMappingInfo
Do
counter = counter + 1
Sys.Refresh()
location.RefreshMappingInfo
If(location.FindChild( typeID, name,30).Exists <> Empty ) Then
IfObjectExists = True
log.Message("Find this object - '"+typeID+"', '"+name+"' - and click!")
object = location.FindAllChildren(typeID, name, 20000, True)
For i = 0 to UBound(object)
If object(i).Exists Then object(i).Click
Next
Log.Message "Find: " & (UBound(object) + 1)
Call location.Wait
Else
IfObjectExists = False
aqUtils.Delay(2000)
Sys.Refresh()
location.RefreshMappingInfo
log.Message ("Doesn't find this objects: '"+typeID+"', '"+name+"'")
End If
Loop Until IfObjectExists = True or counter > 25
End Function
------------------------------------------------
Regards
Armands