poisonkiller Posted September 25, 2005 Share Posted September 25, 2005 How can i read how much bytes or mb more until downloading? Example: Im downloading with Autoit one big file. How can i read how many mb or bytes left? Link to comment Share on other sites More sharing options...
Ghastly_MIB Posted September 25, 2005 Share Posted September 25, 2005 (edited) Just get the total size of the file first, then minus the readed bytes: ;$url = your link to the file ;$filename = your place where the file must download to $size = InetGetSize($url) InetGet($url, $filename, 0, 1) While @InetGetActive $SizeToDownload = $size - @InetGetBytesRead TrayTip("Download", "Bytes to download: "&$SizeToDownload, 1) Wend $SizeToDownload is now how much you still need to download Edited September 25, 2005 by Ghastly_MIB Link to comment Share on other sites More sharing options...
poisonkiller Posted September 25, 2005 Author Share Posted September 25, 2005 This is my code: #include <GUIConstants.au3> GUICreate("Autoit download", 200, 100) $label = GUICtrlCreateLabel("Write here filename(with "".exe""):", 10, 10, 200, 20) $file = GUICtrlCreateInput("", 10, 30, 180, 20) $okbutton = GUICtrlCreateButton("Download", 10, 60, 60, 30) $read = GUICtrlCreateLabel("Bytes to download: ", 80, 60, 100, 40) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $okbutton Then GUISetState(@SW_DISABLE) GUICtrlSetData($label, "Downloading...") $size = InetGetSize("http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/" &GUICtrlRead($file)) $inet = InetGet("http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/" &GUICtrlRead($file), GUICtrlRead($file)) While @InetGetActive $ToDown = $size - @InetGetBytesRead GUICtrlSetData($read, "Bytes to download: " &$ToDown) Wend GUICtrlSetData($label, "File downloaded!") GUISetState(@SW_ENABLE) EndIf If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend Its not setting $ToDown to $read. How can i fix it???? Link to comment Share on other sites More sharing options...
Ghastly_MIB Posted September 25, 2005 Share Posted September 25, 2005 Your download is not on the background:This is the working code:---------------------------------------------------------------------#include <GUIConstants.au3>GUICreate("Autoit download", 200, 100)$label = GUICtrlCreateLabel("Write here filename(with "".exe""):", 10, 10, 200, 20)$file = GUICtrlCreateInput("", 10, 30, 180, 20)$okbutton = GUICtrlCreateButton("Download", 10, 60, 60, 30)$read = GUICtrlCreateLabel("Bytes to download: ", 80, 60, 100, 40)GUISetState()While 1 $msg = GUIGetMsg() If $msg = $okbutton Then If GUICtrlRead($file) = "" Then MsgBox(48, "AutoIt Download", "Please give an place to download to") Else GUISetState(@SW_DISABLE) GUICtrlSetData($label, "Downloading...") $size = InetGetSize("http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe") $inet = InetGet("http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe", GUICtrlRead($file), 0, 1) While @InetGetActive $ToDown = $size - @InetGetBytesRead GUICtrlSetData($read, "Bytes to download: " &$ToDown) Wend GUICtrlSetData($label, "File downloaded!") GUISetState(@SW_ENABLE) EndIf EndIf If $msg = $GUI_EVENT_CLOSE Then ExitLoopWend---------------------------------------------------------------------The line's in red are chanced 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