Jump to content

Recommended Posts

Posted

hey hi

i want to use winwait on some time limit and not on title can i do that ?? i mean to say winwait("250") something like this, could anyone help me on this

Posted

Hi,

you may use the timeout parameter:

WinWait ( "title" [, "text" [, timeout]] )

or just a simple sleep () meets your requirement.

;-))

Stefan

Posted

see basically i am downloading a file but i dont know how much time it will take, and once it downloads i have to open that file, this can happen only after the file is downloaded completely, so how do i manage that time difference ??

Posted (edited)

Hi,

depending how the download works:

1) If file size grows by time, just compare file size on source and target in a loop.

Do
    sleep (250)
Until FileGetSize ($target) >= FileGetSize ($source); you might use InetGetSize if you download from url

2) If you use another program for download, check with processexists in a loop if download is ready.

$pid = ProcessExists ("mydownload.exe") 
While $pid <> 0
    sleep (250)
    $pid = ProcessExists ("mydownload.exe")
WEnd

3) Try to open the file in read mode. If failure, wait.

$file = FileOpen ("myfile", 0)
While $file = - 1
    sleep (250)
    $file = FileOpen ("myfile", 0)
WEnd
FileClose ($file)

;-))

Stefan

Edited by 99ojo
Posted

Hi,

depending how the download works:

1) If file size grows by time, just compare file size on source and target in a loop.

Do
    sleep (250)
Until FileGetSize ($target) >= FileGetSize ($source); you might use InetGetSize if you download from url

2) If you use another program for download, check with processexists in a loop if download is ready.

$pid = ProcessExists ("mydownload.exe") 
While $pid <> 0
    sleep (250)
    $pid = ProcessExists ("mydownload.exe")
WEnd

3) Try to open the file in read mode. If failure, wait.

$file = FileOpen ("myfile", 0)
While $file = - 1
    sleep (250)
    $file = FileOpen ("myfile", 0)
WEnd
FileClose ($file)

;-))

Stefan

hey thanks stefan :mellow::)

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...