Jump to content

Recommended Posts

Posted (edited)

Hello,

 

from some version archive for a free software I wrote a script to downloads all these versions and ist doing a resort / rename of the resulting files. As it's about 200 files, I wanted to use the background parameter of InetGet(), but experienced, that it doesn't seem to work.

 

The help file tells:

If the background parameter is set to $INET_DOWNLOADBACKGROUND (1) the function returns immediately and the download continues in the background. The function InetGetInfo() can be used to check the status of the download. It takes the handle returned from InetGet().

Multiple downloads are supported if they are started in background mode.
 

Q1: Is there a limit for the number of the simultaneous downloads, that can run at the same time? (Number of Windows' sockets e.g.)

Q2: Propably I have to monitor the background downloads and keep the script running, until they are all done, and when I don't do that, the "natural end" of the script (while background downloads are still running) will terminate the running downloads as well? (

 

The help file examle uses a loop:

; [snip]
Do
    Sleep(250)
Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE)

 

 

 

 

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

  • Solution
Posted (edited)

I have seen a true reduction of performance using this kind of approach while you are having lots of downloads at a time :

 

But it seems to get much more effective using a multi-threading approach :

 

ps.  AutoIt is and will stay single threaded, no matter how hard you try, multi-threaded will always be more effective under the right circumstances.

Edited by Nine
Posted

Hi @rudi 👋 ,

maybe you could consider to avoid InetGet() at all and use "_WinHttpSimpleRequest" or a similar request of this UDF (library).

#include "WinHttp.au3"

In the "au3WebDriver" project we (@Danp2, @milpok (also me kind of)) also discovery InetGet() is not the robustess way of downloading files.
I personally use cURL (curl.exe) for such things which is very handy 😀 .

Best regards
Sven

==> AutoIt related: 🔗 GitHub, 🔗 Discord Server

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Posted

OK, thanks for the Input.

So I think I will use Autoit to create the wanted folder structure and to create a powershell script doing the downloads, always e.g. 10 simultaneously, using Invoke-WebRequest

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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
  • Recently Browsing   0 members

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