DigDeep Posted January 20, 2017 Share Posted January 20, 2017 I would need some urgent help here please... Activities performed below: Start button pressed > GUI Lable shows Text message > activities start > When download starts, it shows the Progressbar with the Filesize remaining and Percentage completed and Progressbar moving. All the above activites happen except the Progressbar does not show any progress nor any Percentage and filesize. For some reason, I am not able to fit the _GetDisplaySize after the $Totalsize1. expandcollapse popup#RequireAdmin #NoTrayIcon #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <ProgressConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $iPlaces Func _GetDisplaySize($iTotalDownloaded, Const $iPlaces) ; Get file size Local Static $aSize[4] = ["Bytes remaining...", "KB remaining...", "MB remaining...", "GB remaining..."] For $i = 0 To 3 $iTotalDownloaded /= 1024 If (Int($iTotalDownloaded) = 0) Then Return Round($iTotalDownloaded * 1024, $iPlaces) & " " & $aSize[$i] Next EndFunc ;==>_GetDisplaySize Func VLC() $Lable1 = GUICtrlCreateLabel(@CRLF & @CRLF & 'Installing VLC Player...', 232, 112, 345, 193) GUICtrlSetFont(-1, 11, 400, 0, "Arial") Local $sfldr = "C:\Temp" DirCreate($sfldr) Local $Src = "http://get.videolan.org/vlc/2.2.4/win32/vlc-2.2.4-win32.exe" ;Set URL $Dest = $sfldr & '\vlc.exe' ;Set folder $Down = InetGet($Src, $Dest, 1, 1) ;Forces a reload from the remote site and return immediately and download in the background $SrcSize1 = InetGetSize($Src) ;Get file size Local $idProgressbar1 = GUICtrlCreateProgress(288, 256, 238, 17) GUICtrlSetColor(-1, 32250); not working with Windows XP Style While Not InetGetInfo($Down, 2) ;Loop until download is finished Sleep(3000) ;Sleep for half a second to avoid flicker in the progress bar $GetBytes1 = InetGetInfo($Down, 0) ;Get bytes received $Percentage1 = Int($GetBytes1 / $SrcSize1 * 100) ;Calculate percentage $Totalsize1 = $SrcSize1 - $GetBytes1 WEnd EndFunc $Form2 = GUICreate("Form2", 626, 491, 466, 301) $Start = GUICtrlCreateButton("Start", 264, 416, 75, 25) $Label1 = GUICtrlCreateLabel("Label1", 112, 40, 388, 361) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $Start VLC() EndSelect WEnd Link to comment Share on other sites More sharing options...
DigDeep Posted January 20, 2017 Author Share Posted January 20, 2017 I added the below line and now I am able to see the Progressbar moving along with the download. But I am still not able to figure out the _GetDisplaySize... $Totalsize1 = $SrcSize1 - $GetBytes1 GUICtrlSetData($idProgressbar1, $Percentage1) Link to comment Share on other sites More sharing options...
spudw2k Posted February 7, 2017 Share Posted February 7, 2017 I don't see where you are calling or assigning the output from _GetDisplaySize. Where do you expect it to display? Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
R0G Posted February 9, 2017 Share Posted February 9, 2017 (edited) Try this: expandcollapse popup#RequireAdmin #NoTrayIcon #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <ProgressConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $iPlaces main() Func main() $Form2 = GUICreate("Form2", 626, 491, 466, 301) $Start = GUICtrlCreateButton("Start", 264, 416, 75, 25) $Label1 = GUICtrlCreateLabel("Label1", 112, 40, 388, 361) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $Start VLC() EndSelect WEnd EndFunc Func VLC() $Lable1 = GUICtrlCreateLabel(@CRLF & @CRLF & 'Installing VLC Player...', 232, 112, 345, 193) $LBL_Percent = GUICtrlCreateLabel("0%", 232, 256, 45, 30) GUICtrlSetFont(-1, 11, 400, 0, "Arial") Local $sfldr = "C:\Temp" DirCreate($sfldr) Local $Src = "http://get.videolan.org/vlc/2.2.4/win32/vlc-2.2.4-win32.exe" ;Set URL $Dest = $sfldr & '\vlc.exe' ;Set folder $Down = InetGet($Src, $Dest, 1, 1) $SrcSize1 = InetGetSize($Src) ;Get file size Local $idProgressbar1 = GUICtrlCreateProgress(288, 256, 238, 17) GUICtrlSetColor(-1, 32250); not working with Windows XP Style Local $Size = InetGetSize($Src,1) ;get the size of the update While Not InetGetInfo($Down, 2) Local $Percent = Round((InetGetInfo($Down,0)/$Size)*100,1) GUICtrlSetData($idProgressbar1,$Percent) GUICtrlSetData($LBL_Percent,$Percent & "%") Sleep(100) WEnd GUICtrlSetData($Lable1,"Download Complete") EndFunc Edited February 9, 2017 by R0G Link to comment Share on other sites More sharing options...
SyedHamza Posted April 25, 2021 Share Posted April 25, 2021 i wanna set icon for my progress bar, how i do it? for example, it my progress bar Quote ProgressOn("Fall Guys: Ultimate Knockout", "Setup", "Connecting to server...") For $var1 = 0 To 30 ProgressSet($var1) Sleep(200) Next which and where I insert the command to do this Link to comment Share on other sites More sharing options...
Developers Jos Posted April 25, 2021 Developers Share Posted April 25, 2021 @SyedHamza Please do not Cross post your question and stick to one! Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts