Sign in to follow this  
Followers 0
bobthenob

how to exit loop after given time

3 posts in this topic

hi

i have learnt a lot from reading, and the help of others on these forums thanks.

my program works 90% correct!

but once in a while it gets stuck.

I think ive found the fault it some times misses the status bar text im looking for. (Start downloading from site:)

What im trying to do, is if it looks for an amount of time, say 5 seconds, the move on but i cant seem to do this.

I looked at using TimerDiff but could seem to work out quite how to implement it. Cheers

Opt("WinTitleMatchMode", 2)
#include <IE.au3>
#include <String.au3>
#include <File.au3>

    Dim $state
     $oIE = _IECreate ("website")
     WinSetState("[class:IEFrame]","",@SW_MAXIMIZE)
     _IELoadWait($oIE)
    WinActivate("[class:IEFrame]","")

 Do
    $state = StatusbarGetText("[class:IEFrame]","")
    until $state = "Start downloading from site: " ; this is were it gets stuck some times[/color]
    sleep(500)                                 ; if it sits here for say five seconds id like to move on[/color]

    
 Do
        $state = StatusbarGetText("[class:IEFrame]","")
    Until $state = "Done"                  
    sleep(1000)

    winactivate ("[class:IEFrame]","")
winwaitactive ("[class:IEFrame]","")
$o_form = _IEFormGetObjByName ($oIE, "frmlogin")
$o_login = _IEFormElementGetObjByName ($o_form, "username")
$o_password = _IEFormElementGetObjByName ($o_form, "password")
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEFormSubmit ($o_Form)

Share this post


Link to post
Share on other sites



Try This

$Timer=TimerInit()
 Do
    $state = StatusbarGetText("[class:IEFrame]","")
    until $state = "Start downloading from site: " or TimerDiff($Timer)>=5000 ; this is were it gets stuck some times[/color]
    sleep(500)

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

thanks that will help me

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0