Sign in to follow this  
Followers 0
Fran

Multiple file download with progress

9 posts in this topic

#1 ·  Posted (edited)

Hi there,

I hope someone can help with my script. I've attached an example of it.

My first script was doing a CRC check after each file was downloaded, which was working very nicely, but extremely slow. The problem is not the checking so much, but the fact that the files are downloading 1 at a time.

I would like to download 2 or 3 files at a time and show the progress of the downloads. At the moment I can download 1 file at a time, show the progress and also the overall progress of the whole download.

I've tried downloading 2 files at a time by changing the Start_DL2() & DL_Check2() functions, but the way I did it, the script would have waited for both files to be finished downloading before it starts the next 2 files. I want the GUI to return immediately after 1 file has downloaded and start the next 1 while the other is still busy.

I hope this is possible!

I want to do the CRC check after each file has downloaded as well. If it fails, it should download again. This loop can carry on 3 times before it skips the file. (very easy to add to the script, so don't worry about this part)

Thanx in advance!

InstallDownloader_example.au3

post-58833-0-35215200-1301899735_thumb.j

_CRC.au3

Edited by Fran

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I know it's possible because firefox did this with his youtube multi downloader. Although he didn't use progress bars, he did give a numbered percent which could easily be translated to progress bars. You can find his downloader in the examples forum :)

Edited by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

Thanx for the help. I have since changed the script to show the progress in listview.

I have a small problem with checking the files though.

Here's what I want to do:

Download a bunch of files

Do a CRC check

If any errors with the CRC, download the failed files again.

Everything seems to work fine until I want to download the failed files again. Can someone please help with my script? I'm uploading it here. (Note: Even though the downloader is only downloading 25 files for this example, in the actual download there will be over 3000 files).

I also do a CRC check before the download starts (if the directory is bigger than 40MB - ie. if the user has downloaded a bunch of files already) - Problem is if only 1 file is corrupt. If it's more than 1 the script runs without problems. If there's only 1 file missing, it complains.

Also, when I exit the GUI it complains as well:

Array variable has incorrect number of subscripts or subscript dimension range exceeded.

Referring to Line 262:

If $hDownloadNo[$n] <> 0 Then

Not sure how to fix this.

Thanx!

test.au3

Share this post


Link to post
Share on other sites

After commenting out the crc checks (I don't have _CRC.au3) I ran it. Nice job so far multiple downloads seems to work like a charm.

Since I'm not really sure how to test just a single file download where you are having the problems, I would suggest using msgbox to view what the current variable's value is. That may help find what's going on.

Also, when I am looping through arrays, I like to use UBound as it removes incorrect number of subscripts errors :)

As far as it complaining when the Gui closes. I think you need to add a check in the Gui_Event_Close to see if the download is completed or not. When downloads are still going, there is no error, but when they are all finished then it errors.


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Also, when I am looping through arrays, I like to use UBound as it removes incorrect number of subscripts errors :)

Thanx... I'll give that a try.

By the way... I've uploaded the _CRC.au3 file to the first post.

Edited by Fran

Share this post


Link to post
Share on other sites

ok, I think I may be narrowing down the problem with the single file re-download.

You read how many lines are in the log file, in this case 1

You then recreate the $hDownloadNo array with the number of lines (1)

so your array is actually $hDownloadNo[0] (arrays start with 0)

I'll keep checking between jobs at work :)


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

One thinI noticed, your filecountlines is returning a 0 (failure), instead of the 1 it should for the error log.

another thing I noticed, your $checkfile returns CRC_basic.txt in an empty rsinst folder. The log file I expected it o be checking was the one placed on my desktop (location of the script) that has the name errlog_2011 (then random numbers) as this file has the deleted filename in it.

*edit*

this led me to discover that the desktop is the original location for the log file and it was supposed to be moved to the rsinst folder, however, it is not being moved which is why filecountlines is failing.

Edited by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

Wow, thanx for the help. Looks like I need to do a bit of clean up in that script of mine.

Do you have any good solutions for error checking / debugging? Inserting a line of code (Consolewrite or something) for every line I want to check is probably not the way to do it.

Share this post


Link to post
Share on other sites

All sorted... I think :)

I'm attaching the modified script. I've also added in a check for Dotnet. If the user has dotnet 2.0 or later, it will not be downloaded.

test.au3

@kaotkbliss Thanx again for you help! :)

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