Jump to content

Download wait problem


Recommended Posts

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 ?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 it

You 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 complete

Takes about three lines of code

Rick

Link to comment
Share on other sites

@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!
Link to comment
Share on other sites

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...

Link to comment
Share on other sites

@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

Link to comment
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
 Share

  • Recently Browsing   0 members

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