rudi Posted February 2 Posted February 2 (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 February 2 by rudi Earth is flat, pigs can fly, and Nuclear Power is SAFE!
argumentum Posted February 2 Posted February 2 1 hour ago, rudi said: Q1: ... Q2: ... ..well, ..give it a try. I would every so often check that InetGetInfo($hDownload1ofX, $INET_DOWNLOADCOMPLETE) a check, say, every 10 sec ?, to know when to close the script. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Solution Nine Posted February 2 Solution Posted February 2 (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 February 2 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy
rudi Posted February 3 Author Posted February 3 @Nine: Thanks for pointing out your Multi-Threading UDF Anybody experienced regarding the Windows' limit for concurrent downloads, in combination with doing the downloads from an Autoit Script? Mentioned e.g. here: https://stackoverflow.com/questions/38511515/how-to-increase-the-number-of-concurrent-downloads-initiated-by-an-extension Earth is flat, pigs can fly, and Nuclear Power is SAFE!
SOLVE-SMART Posted February 3 Posted February 3 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)
Nine Posted February 3 Posted February 3 @rudi Yep, this is exactly what I observed when downloading from a single thread. Only a few gets started the rest waiting in line... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy
rudi Posted February 4 Author Posted February 4 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 SOLVE-SMART 1 Earth is flat, pigs can fly, and Nuclear Power is SAFE!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now