ludocus Posted June 11, 2009 Posted June 11, 2009 Hi, I am making this gui for a couple of programs to update and stuff.. The first progressbar shows the progress for 1 file, the second progressbar shows progress for total files.. Altough the second progress bar doesn't work.. can you help me?? expandcollapse popupFunc _DownloadGUI($url, $dir, $overwrite = 0) $downloadGUI = GUICreate("", 633, 161, -1, -1, $WS_POPUPWINDOW, Default, $Form1) $titlebar = GUICtrlCreatePic($barpic, 0, 0, 633, 25) GUICtrlSetState(-1, $GUI_DISABLE) $bartitle = GUICtrlCreateLabel('Downloading, 0%', 10, 2, @DesktopWidth, 23, Default, $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetFont(-1, 12, 800, '', 'Arial') GUISetBkColor($bkclr) $nlmlbl = GUICtrlCreateLabel("Downloading [0/0]:", 8, 40, 150, 17) $Progress = GUICtrlCreateProgress(8, 100, 614, 25) $Progress2 = GUICtrlCreateProgress(8, 130, 614, 25) $staticlabel = GUICtrlCreateLabel("Retreiving files, please wait...", 8, 60, 612, 20) GUISetState(@SW_SHOW) $retz = '' $totalsize = 0 $donesize = 0 For $i = 1 to $url[0] If StringInStr($url[$i], ' [-PATH-] ') Then $zs = StringSplit($url[$i], ' [-PATH-] ', 1) $link = $zs[1] Else $zs = StringSplit($url[$i], ' [-AA-] ', 1) $link = $zs[1] EndIf $totalsize += InetGetSize($link) Next msgbox(0, $donesize, $totalsize) For $i = 1 To $url[0] If StringInStr($url[$i], ' [-PATH-] ') Then $zs = StringSplit($url[$i], ' [-PATH-] ', 1) $fullpath = StringReplace($zs[2], '{TEMPDIR}', @TempDir) $link = $zs[1] $retz = $fullpath Else $zs = StringSplit($url[$i], ' [-AA-] ', 1) If $zs[0] < 2 Then ExitLoop $link = $zs[1] $fullpath = $dir & '\' & $zs[2] EndIf GUICtrlSetData($nlmlbl, "Downloading [" & $i & '/' & $url[0] & ']:') GUICtrlSetdata($staticlabel, $fullpath) ;ClipPut(ClipGet() & @CRLF & $link & ' - ' & $fullpath) $gzz = True If $overwrite = 0 Then $gzz = False If Not FileExists($fullpath) Then $gzz = True EndIf If $gzz = True Then $tSize = InetGetSize($link) InetGet($link, $fullpath, 1, 1) ;$kb = Round($tSize / 1024) If $debug = True Then _DebugWrite('downloading file ' & $i) While @InetGetActive $P = (100 * @InetGetBytesRead) / $tSize $donesize += @InetGetBytesRead $P2 = ($donesize/$totalsize)*100 ;$kbi = Round(@InetGetBytesRead / 1024) GUICtrlSetData($Progress, $P) GUICtrlSetData($Progress2, $P2) GUICtrlSetData($bartitle, 'Downloading, '&Round($P2)&'%') Sleep(100) Tooltip($donesize&'\'&$totalsize) WEnd ;If $debug = True Then _DebugWrite('downloaded file ' & $i) Else $donesize += InetGetSize($link) EndIf $P2 = ($donesize/$totalsize)*100 GUICtrlSetData($Progress2, $P2) GUICtrlSetData($bartitle, 'Downloading, '&Round($P2)&'%') Next GUIDelete($downloadGUI) Return $retz EndFunc ;==>_DownloadGUI
Valuater Posted June 11, 2009 Posted June 11, 2009 (edited) There is not enough nfo there and its early.... lolthis isn't right $donesize += @InetGetBytesRead ( rewmove the "+")and I dont know where $totalsize comes from, cause it's not in the script8) Edited June 11, 2009 by Valuater
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