Wb-FreeKill Posted November 2, 2004 Share Posted November 2, 2004 (edited) This program should download a file from the internet, all you have to do is to insert the full link into the input box, and press the download button, then the progressOn shows the process in % and how many Mb download so far. The problem is, when you run the script, and inserts the link and presses the download button, the progressbar pops up, but it do not show the progress. Maybe its because the Progress on is in the loop, i dont know.. Btw, is it possible to use the progressbar in the GUI? I hope you can help me expandcollapse popup#Include <GUIConstants.au3> WinClose("Download Time maneger", "") GUICreate("Download Time maneger", 390,250) GUICtrlCreatelabel ("Download 1", 10, 20, 300, 20) $dl1 = GUICtrlCreateInput ("", 10, 35, 200, 20) ;insert link to the file $knap = GUICtrlCreateButton ("Download file",250,30,100,25) ;download button $size = InetGetSize($dl1) $Procent = $size / 100 $h = $Procent $aktualsize = 0 $i = 0 GUISetState (@SW_SHOW) while 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop if $msg = $knap then ProgressOn("Progress Meter", "downloaded", "0 percent") msgbox(0,"test",GUIRead($dl1)) if $aktualsize = 0 then InetGet(GUIRead($dl1), "test.rar", 1, 1) ; -----> the file to download <----- elseif $aktualSize > $Procent then $OmRegnSize = $aktualsize / 1024 / 1024 $OmregnSize = Round($OmRegnSize, 2) $size1 = $size / 1024 / 1024 $size1 = Round($size1, 2) ProgressSet( $i, $i & " % downloaded " & $OmRegnSize & " Mb of " & $size1 & " Mb") $Procent = $procent + $h $i = $i +1 elseif $aktualsize = $size then exitloop endif sleep(100) $aktualsize = FileGetSize("test.rar") endif wend ProgressSet(100 , "Done", "Complete") sleep(1000) ProgressOff() Edited November 2, 2004 by Wb-FreeKill Link to comment Share on other sites More sharing options...
Wb-FreeKill Posted November 2, 2004 Author Share Posted November 2, 2004 (edited) This one works: I just can't get it to work when i want to input the link in the inputbox, and then press the download button expandcollapse popup#Include <GUIConstants.au3> $size = InetGetSize("http://www.ige.dk/files/Battlefield2/BF2-Lanvegas.rar") $Procent = $size / 100 $h = $Procent $aktualsize = 0 $i = 0 GUISetState (@SW_SHOW) ProgressOn("Progress Meter", "downloaded", "0 percent") while 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop if $aktualsize = 0 then InetGet("http://www.ige.dk/files/Battlefield2/BF2-Lanvegas.rar", "test.rar", 1, 1); -----> the file to download <----- elseif $aktualSize > $Procent then $OmRegnSize = $aktualsize / 1024 / 1024 $OmregnSize = Round($OmRegnSize, 2) $size1 = $size / 1024 / 1024 $size1 = Round($size1, 2) ProgressSet( $i, $i & " % downloaded " & $OmRegnSize & " Mb of " & $size1 & " Mb") $Procent = $procent + $h $i = $i +1 elseif $aktualsize = $size then exitloop endif sleep(100) $aktualsize = FileGetSize("test.rar") wend ProgressSet(100 , "Done", "Complete") sleep(1000) ProgressOff() Edited November 2, 2004 by Wb-FreeKill Link to comment Share on other sites More sharing options...
jpm Posted November 3, 2004 Share Posted November 3, 2004 This one works:I just can't get it to work when i want to input the link in the inputbox, and then press the download button I don't know if the filegetsize can work but I am sure @InetGetBytesRead is the right variable to use to verify the downmload process see InetGet doc. 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