Jump to content

Multiple Tasks ?


Bot
 Share

Recommended Posts

I'm working on a batch downloader.

Dim $linkarray[8]
$linkarray[0] = "link0"
$linkarray[1] = "link1"
$linkarray[2] = "link2"
$linkarray[3] = "link3"
$linkarray[4] = "link4"
$linkarray[5] = "link5"
$linkarray[6] = "link6"
$linkarray[7] = "link7"

Func download($link)
; Download the file ...
EndFunc

For $i = 0 To 8
download($linkarray[$i])
Next

With the For loop, I can use the function download() one by one and each action must be completed before performing other. Can anyone please show me how can I do 4 actions at once and if one of them is completed, then it will perform other action until all are complete ?

Link to comment
Share on other sites

I'm working on a batch downloader.

Dim $linkarray[8]
$linkarray[0] = "link0"
$linkarray[1] = "link1"
$linkarray[2] = "link2"
$linkarray[3] = "link3"
$linkarray[4] = "link4"
$linkarray[5] = "link5"
$linkarray[6] = "link6"
$linkarray[7] = "link7"

Func download($link)
; Download the file ...
EndFunc

For $i = 0 To 8
download($linkarray[$i])
Next

With the For loop, I can use the function download() one by one and each action must be completed before performing other. Can anyone please show me how can I do 4 actions at once and if one of them is completed, then it will perform other action until all are complete ?

InetGet can download files from links. check the helpfile for it :)
Link to comment
Share on other sites

InetGet can download files from links. check the helpfile for it :)

Note, only one download can be active at once, if you call the function again before a download is complete it will fail.

Edited by Gif
Link to comment
Share on other sites

@InetGetActive = 1 while downloading, or 0 when finished.

Thats a tough error check...

Dim $linkarray[8]
$linkarray[0] = "link0"
$linkarray[1] = "link1"
$linkarray[2] = "link2"
$linkarray[3] = "link3"
$linkarray[4] = "link4"
$linkarray[5] = "link5"
$linkarray[6] = "link6"
$linkarray[7] = "link7"

Func download($link)
InetGet($link,$Filename)
$size = Inetgetsize($Link)
While @InetGetActive
    ToolTip(Round((@InetGetBytesRead/$Size)/1024,0),0,0)
WEnd
EndFunc

For $i = 0 To 8
     download($linkarray[$i])
Next
Edited by Paulie
Link to comment
Share on other sites

If I use _INetGetSource instead of Inetget, may it's possible to do then ? :)

Autoit is not multi-threaded.

and Inetget may only be called 1 at a time.

_Inetgetsource does something totally different... won't work

Link to comment
Share on other sites

Try this:

Dim $linkarray[8]
$linkarray[0] = "http://infospeed.verizon.net/car/data5MB.zip"
$linkarray[1] = "http://infospeed.verizon.net/car/data5MB.zip"
$linkarray[2] = "http://infospeed.verizon.net/car/data5MB.zip"
$linkarray[3] = "http://infospeed.verizon.net/car/data5MB.zip"
$linkarray[4] = "http://infospeed.verizon.net/car/data5MB.zip"
$linkarray[5] = "http://infospeed.verizon.net/car/data5MB.zip"
$linkarray[6] = "http://infospeed.verizon.net/car/data5MB.zip"
$linkarray[7] = "http://infospeed.verizon.net/car/data5MB.zip"

For $i = 0 To 7
    Run(@AutoItExe & ' /AutoIt3ExecuteLine "InetGet(''' & $linkarray[$i] & ''', ' & '''file' & $i & '.zip'', 1' & ')"')
Next

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

When I tried it, it created 7 AutoIT3.exe processes and my computer got crashed :) I will try another solution

It should generate one main AutoIt3.exe that will start and end pretty quickly. That main exe should launch 8 other AutoIt3.exe processes (one for each link). My system handled the script just fine.

I'm not certain, but the InetGet function might be impacted by the setttings mentioned here: http://support.microsoft.com/kb/282402

Are there any other forum members having trouble running that script?

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

It should generate one main AutoIt3.exe that will start and end pretty quickly. That main exe should launch 8 other AutoIt3.exe processes (one for each link). My system handled the script just fine.

I'm not certain, but the InetGet function might be impacted by the setttings mentioned here: http://support.microsoft.com/kb/282402

Are there any other forum members having trouble running that script?

Hmmm.... I ran it and all went well, but it was rather taxing at 20% CPU, a really slow computer would probably have a difficult time of it.
Link to comment
Share on other sites

...it was rather taxing at 20% CPU...

Little, if any of that CPU time is related to AutoIt. Simultaneous downloads are taxing. Try them without AutoIt - start 8 of the 100MB files from this page manually and see what your CPU load is:

http://www2.verizon.net/micro/speedtest/

:-)

[size="1"][font="Arial"].[u].[/u][/font][/size]

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