Truffle Posted June 21, 2005 Share Posted June 21, 2005 I wrote a script almost exactly like the one im gonna paste here that downloaded a file from the net showing a progress bar and when reached 100% it let you know. I wrote it two months ago and it worked fine. Now I cant click on Cancel and no progress bar moves until the end of the download because the GUI is locked up. The code im going to post may look a little weird because A) I wrote it. I messed with it quite a bit hoping to get the progress bar to move expandcollapse popup#include <GuiConstants.au3> GuiCreate("Downloader", 392, 195,(@DesktopWidth-392)/2, (@DesktopHeight-195)/2 , $WS_VISIBLE + $WS_CLIPSIBLINGS) DirRemove("C:\dltmp",1) #region --- Start Defining GUI Controls --- $progressbar1 = GuiCtrlCreateProgress(20, 40, 350, 30) $cancelButton = GuiCtrlCreateButton("Cancel", 140, 130, 80, 25) $exitButton = GuiCtrlCreateButton("Exit", 140, 130, 85, 25) #endregion --- End of GUI Controls --- $fileSize = InetGetSize("http://www.olhideout.net/maps/spacewar.zip") GUICtrlSetState($exitButton,$GUI_HIDE) DirCreate("C:\dltmp") $downloading = 1 sleep(1000) InetGet("http://www.olhideout.net/maps/spacewar.zip","C:\dltmp\spacewar.zip") GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $exitButton ExitLoop case $msg = $cancelButton InetGet("abort") Case Else ;;; EndSelect WEnd While $downloading = 1 $p = INT( (@InetGetBytesRead/$fileSize) * 100) GUICtrlSetData ($progressbar1,$p) if @InetGetBytesRead = $fileSize Then $downloading = 0 GUICtrlSetState($cancelButton,$GUI_HIDE) GUICtrlSetState($exitButton,$GUI_SHOW) $continue = MsgBox(64,"Download Completed","Your Download Has Finished") if $continue = 1 Then EndIf EndIf WEnd Exit If I replace while downloading = 1 with while @InetGetActive I get the same result plus no messagebox at the end. I'm not even sure if Autoit is acknowledging the @InetGetActive. I tried it on the latest Beta and on the latest Stable release. Help! Please Is it just my computer? I thought so at first until I tried it on my second PC. Link to comment Share on other sites More sharing options...
jpm Posted June 21, 2005 Share Posted June 21, 2005 Your script will never go out of the first while loop unless you close the GUI or you click on the exit button So it is normal you never execute the second while whatever the condition you are using. Link to comment Share on other sites More sharing options...
Truffle Posted June 21, 2005 Author Share Posted June 21, 2005 well it was originally like this (ive been messing with the code i must have forgotten to change it backWhile 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $exitButton ExitLoop case $msg = $cancelButton InetGet("abort") Case Else ;;; EndSelect If @InetGetActive Then $p = INT( (@InetGetBytesRead/$fileSize) * 100) GUICtrlSetData ($progressbar1,$p) if @InetGetBytesRead = $fileSize Then $downloading = 0 GUICtrlSetState($cancelButton,$GUI_HIDE) GUICtrlSetState($exitButton,$GUI_SHOW) $continue = MsgBox(64,"Download Completed","Your Download Has Finished") if $continue = 1 Then EndIf EndIf EndIfWEndExitThe GUI still locks up Link to comment Share on other sites More sharing options...
jpm Posted June 21, 2005 Share Posted June 21, 2005 InetGet("http://www.olhideout.net/maps/spacewar.zip","C:\dltmp\spacewar.zip",1,1) your inetget must allow download in background as above Link to comment Share on other sites More sharing options...
Truffle Posted June 21, 2005 Author Share Posted June 21, 2005 InetGet("http://www.olhideout.net/maps/spacewar.zip","C:\dltmp\spacewar.zip",1,1)your inetget must allow download in background as above<{POST_SNAPBACK}>cool! Thanks... Another question (sorry) where does Autoit cache these downloads? Im deleting the file it downloads and later I download a 3 MB file in 1 second... even after reboot. Link to comment Share on other sites More sharing options...
jpm Posted June 21, 2005 Share Posted June 21, 2005 cool! Thanks... Another question (sorry) where does Autoit cache these downloads? Im deleting the file it downloads and later I download a 3 MB file in 1 second... even after reboot.<{POST_SNAPBACK}>it is not AutoIt but the proxy/firewall that's you certainly have before the data reach your computer.I am supprised it can be so fast with the force reload parameter on as I suggest.What kind of link speed are you using to access the internet? Link to comment Share on other sites More sharing options...
Truffle Posted June 21, 2005 Author Share Posted June 21, 2005 I download at 27 Kilobytes a second. I do use a proxy server. I turned off the server and dialed in on my dial up account. And it still downloaded the 3 meg file in a second... However this was before the reload parameter so I will try again when I get home. 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