Sign in to follow this  
Followers 0
GEOSoft

File Download With Progress

5 posts in this topic

I know I had somehing saved that was along the lines of what I needed and now it is on the missing list. Here is the code that I have to work with.

If NOT FileExists($Path&$File1)Then
    $NF = MsgBox (4100,'HOSTS Manager','The HOSTS file does not appear to exist on this system'&@LF&'Would you like to install one now?')
    If $NF = 6 Then
  URLDownloadToFile ( "http://www.mvps.org/winhelp2002/hosts.txt", $Path&$File1)
    Else
    Exit
    EndIf
EndIf
Now I want to add a progress meter that should be proportionate to the download.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites



Sure! Ruin my day right off the start. :whistle: I guess I could time the average download and installation speeds and work something out but that seems like cheating. I guess it's also not possible to get a date stamp from a file before it's downloaded.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

URLDownloadToFile is like a RunWait command, the script waits until the command is done before going to the next line, thus "no es posible"

Suggestion would be to change it into:

$NF = MsgBox (4100,'HOSTS Manager','The HOSTS file does not appear to exist on this system'&@LF&'Would you like to install one now?' & @crlf & 'Est. 1 min download')

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Just curious if AdLib code could get around this? If you knew the size of the file, you could make an adlib function to check the size of the file being downloaded and update the progress bar accordingly. After the download finishes, turn off the adlib.

Maybe a function could be added to AutoIt3 to get the size of an item to be downloaded with URLDownloadToFile. Something like URLGetSize($url), then use an adlib function to update a progress bar during the download.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Okay, I just tried using AdLib and it didn't work. Maybe the next version of AutoIt3 could be modified to allow AdLib to run during downloads?

I like the idea of a separate script, given that the adlib thing doesn't work. Maybe have a script check to see if a parameter is specified. If not, create the progress bar and run itself with a parameter, then monitor the file while updating the progress bar. When the second run closes, the first finishes up by closing the progress bar and doing whatever you need done with the downloaded file.

Edited by ryanm

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