Dynamic synchronization allows waiting till the
object property is changed or till time out.
Sample example:
Window("WinFlight").ActiveX("ThreedPanelControl").WaitProperty
"text", "Insert Done...", 10000
The waitproperty can be inserted using Insert
Synchronization point or we can manually add the waitproperty method by
typing typing it.
Apart from this we can also add synchronization
point using following code also
Sample code: 1
Function ManualSyncPoint (Object,propertyname,propertyval,timeout)
Do
If
Object.GetRoProperty(propertyname)=propertyval Then
'if propertyname and propertyval match, come out of the
loop and execute next step
Exit Do
Else
Wait(1)
End If
Loop while(i<=timeout)
End Function
In the preceding method we have
used the static wait; we can implement it without using wait statement as well.
Sample code:2
Function
ManualSyncPoint2(Object ,propertyname, propertyval, timeout )
sttimer = Timer
'Timer allows to get the number
of seconds elapsed since midnight
(12:00 AM)
Do
If
Object.GetROProperty(propertyname) = propertyval then
Exit Do
else
end if
endtimer =
Timer
'The difference between the two
timer objects provides the number of seconds we need to determine for timeout
Loop While ( int (endtimer-sttimer)
<= -timeout)
End Function
Function that allows to wait
till object exists
Sample code:3
Function WaitTillExists(Object,
timeout )
loadtimer = Timer
Do
isObjectExists
= Object.Exist
If
isObjectExists = true Then
Exit Do
else
End If
completetimer
= Timer
Loop While(completetimer-loadtimer
<= timeout)
End Function
No comments:
Post a Comment