Nova Posted July 9, 2004 Posted July 9, 2004 I have written a script and it downloads a program from the web ! I want the script to install the program once its done downloading,but can seem to find an option to do so. The download takes about 10mins on my machine to download.... but on other machines it could take more or less time ! Rite now I have say URLDownloadToFile("http://www.files.com", "C:\WINDOWS\file") Sleep(600000) Run("file.exe", "",) In the above script im just guessing the time its going to take to download the file before running the downloaded file. Dose anyone know of a way I can write this script with out guessing the time,so that the script waits till the file is downloaded before it trys to run it ?
pekster Posted July 9, 2004 Posted July 9, 2004 There's no need for a pause command after because the script execution is pause while the file downloads. You will want to check for the file downloading correctally (connection problems, interrupted download, etc.) Perhaps a filesize check, or an md5sum if it should be the exact same file every time? [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.
tutor2000 Posted July 10, 2004 Posted July 10, 2004 There's no need for a pause command after because the script execution is pause while the file downloads. You will want to check for the file downloading correctally (connection problems, interrupted download, etc.) Perhaps a filesize check, or an md5sum if it should be the exact same file every time?Actually someone else had this problem and I lucked out and solved itYou can't move a file while it's downloading so make a loop to keep trying to moveit and when it's moved successfully the download is completeTakes about three lines of codeRick
CyberSlug Posted July 10, 2004 Posted July 10, 2004 @tutor2000: Are you saying that the following code sometimes display a message box before the download is complete? URLDownloadToFile ( "http://www.autoitscript.com/autoit3/files/unstable/autoit/AutoIt3.exe", "C:\LatestAutoIt3.exe" ) MsgBox(4096,"","This message should only print when the download is finished.") Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Valik Posted July 10, 2004 Posted July 10, 2004 If that is what he is saying, then it might be related to the brief period of time when the temporary file is copied from the cache to the final destination. I know that with IE itself, if I download a big file, I actually get a "File Copy" window pop up for a bit while the file is copied from the cahce to my download folder. Beyond that, however, I wouldn't have a clue why that behavior would exist...
tutor2000 Posted July 10, 2004 Posted July 10, 2004 @tutor2000: Are you saying that the following code sometimes display a message box before the download is complete? URLDownloadToFile ( "http://www.autoitscript.com/autoit3/files/unstable/autoit/AutoIt3.exe", "C:\LatestAutoIt3.exe" ) MsgBox(4096,"","This message should only print when the download is finished.")That user may have been using ftp not urldownload sorry about that. Good trick though Rick
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