d4w Posted October 16, 2023 Share Posted October 16, 2023 (edited) Appreciate some guidance with DLs with an embedded progress bar... The downloaded progress % does not appear to be updating as it is downloading. GUICtrlSetData($hProgress, $Percentage) TIA! progress.au3 Edited October 16, 2023 by d4w Link to comment Share on other sites More sharing options...
Solution benners Posted October 16, 2023 Solution Share Posted October 16, 2023 GUICtrlSetData takes a controlID so use $idProgress Link to comment Share on other sites More sharing options...
Andreik Posted October 16, 2023 Share Posted October 16, 2023 expandcollapse popup#include <InetConstants.au3> #include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <ProgressConstants.au3> $hGUI = GUICreate("Download file", 489, 120, 190, 70) $hStatus = _GUICtrlStatusBar_Create($hGUI, -1, "", $SBARS_TOOLTIPS) Local $aParts[3] = [100, 200, -1] _GUICtrlStatusBar_SetParts($hStatus, $aParts) _GUICtrlStatusBar_SetText($hStatus, "DL progress...",0) Local $idProgress, $hProgress $idProgress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH) $hProgress = GUICtrlGetHandle($idProgress) _GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress) GUISetState(@SW_SHOW) Local $TotalSize, $CalBytes, $Bytes, $size $TotalSize = InetGetSize ("http://ipv4.download.thinkbroadband.com/50MB.zip") Local $hDownload = InetGet("http://ipv4.download.thinkbroadband.com/50MB.zip", _ @DesktopDir & "\50MB.zip", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) $Timer = TimerInit() Do If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit $BytesRead = Round(InetGetInfo($hDownload, 0)) $Percentage = Round(($BytesRead * 100 / $TotalSize)) GUICtrlSetData($idProgress, $Percentage) ; Average download speed _GUICtrlStatusBar_SetText($hStatus, Round($BytesRead / 1024 / TimerDiff($Timer) * 1000) & " kb/s", 1) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) If InetGetInfo($hDownload, 3) Then GUICtrlSetData($idProgress, 100) InetClose($hDownload) Do Until GUIGetMsg() = -3 When the words fail... music speaks. Link to comment Share on other sites More sharing options...
argumentum Posted October 17, 2023 Share Posted October 17, 2023 https://www.autoitscript.com/forum/topic/177371-_estimatedtime-calculate-estimated-time-of-completion/ Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
d4w Posted October 17, 2023 Author Share Posted October 17, 2023 Thanks for all your responses! Spent way too much time looking for the source of the problem.... so happy there's a community to turn to for support. argumentum 1 Link to comment Share on other sites More sharing options...
Musashi Posted October 17, 2023 Share Posted October 17, 2023 23 hours ago, d4w said: Appreciate some guidance with DLs with an embedded progress bar... There is a nice UDF in the german forum. The authors are Oscar (his avatar name in the English forum is @Gorathan) and @UEZ . Current version is from 19.09.2021. Some texts in the function headers are in german, but easy to translate with the help of e.g. Deepl. There is also a sample script included, which offers some programs for testing the download process. https://autoit.de/thread/45697-downloadwithprogress/?pageNo=1 "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
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