AnuReddy Posted February 22, 2010 Posted February 22, 2010 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
99ojo Posted February 22, 2010 Posted February 22, 2010 Hi, you may use the timeout parameter: WinWait ( "title" [, "text" [, timeout]] ) or just a simple sleep () meets your requirement. ;-)) Stefan
AnuReddy Posted February 22, 2010 Author Posted February 22, 2010 means just timeout with winwait will also do??
AnuReddy Posted February 22, 2010 Author Posted February 22, 2010 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 ??
99ojo Posted February 22, 2010 Posted February 22, 2010 (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 February 22, 2010 by 99ojo
AnuReddy Posted February 22, 2010 Author Posted February 22, 2010 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now