antiviruscoder Posted July 15, 2007 Share Posted July 15, 2007 The problem that im haveing is, I need the gui to stay as it is because im going to add quite a few more buttens soon. The only problem with it is, the progress bar doesnt move during the download process. could anyone help? heres the code expandcollapse popup#include <GUIConstants.au3> GuiCreate("OPENGEN DOWNLOAD CENTER", 750, 350,(@DesktopWidth-157)/3, (@DesktopHeight-300)/3) $progressbar1 = GUICtrlCreateProgress (20,300,700,40) GUICtrlSetColor(-1,32250); not working with Windows XP Style $FileUrl = "http://www.virustester.knight47.com/newistantivirustest.zip" $FileSize = InetGetSize($FileUrl) $FileName = StringSplit($FileUrl, "/") $FileName = $FileName[$FileName[0]] $button1 = GUICtrlCreateButton("download", 20, 20, 100, 50) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop ; Executer Case $msg = $button1 Sleep(500); display for 5 seconds. InetGet($FileUrl,@scriptdir & "\" & $FileName, 1, 1) TrayTip("", "download in progress... Please don't shutdown or restart your computer for any reason!!!", 5) HotKeySet("{ESC}", "_InetGetAbort") While @InetGetActive $Progressbar1 = Int((100 * @InetGetBytesRead) / $FileSize) Sleep(250) WEnd Func _InetGetAbort() InetGet("abort") EndFunc;==> _InetGetAbort() EndSelect WEnd Exit thx very much [center][spoiler]My little joke!!!![/spoiler][/center][center]!!!!!!!!!!!!!!!!!!!!!!!!!!!!![/center][center]Best code site ever[/center][center]!!!!!!!!!!!!!!!!!!!!!!!!!!!!![/center][center][spoiler]My litte joke!!!![/spoiler][/center] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 15, 2007 Moderators Share Posted July 15, 2007 Run au3check from SciTe editor and you'll see some of your errors, get those cleaned up (one I spot right away is you can't have a function within a loop like that)... anyway, fix the errors it says you have, and if it still doesn't work, post the syntaxed corrected code for more help. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
antiviruscoder Posted July 15, 2007 Author Share Posted July 15, 2007 Ok i ran it and i cant understand what it says... this is what it gave me: >C:\Program Files\AutoIt3\SciTE\..\au3check.exe "C:\Users\draygoes\Desktop\download.au3" AutoIt3 Syntax Checker v1.54 Copyright (c) Tylo 2006 C:\Users\draygoes\Desktop\download.au3(34,1) : ERROR: missing EndSelect. Func ^ C:\Users\draygoes\Desktop\download.au3(17,12) : REF: missing EndSelect. Select ~~~~~~~~~~~^ C:\Users\draygoes\Desktop\download.au3(34,1) : ERROR: missing Wend. Func ^ C:\Users\draygoes\Desktop\download.au3(15,1) : REF: missing Wend. While ^ C:\Users\draygoes\Desktop\download.au3(37,1) : ERROR: syntax error EndSelect ^ C:\Users\draygoes\Desktop\download.au3 - 3 error(s), 0 warning(s) >Exit code: 2 Time: 0.618 [center][spoiler]My little joke!!!![/spoiler][/center][center]!!!!!!!!!!!!!!!!!!!!!!!!!!!!![/center][center]Best code site ever[/center][center]!!!!!!!!!!!!!!!!!!!!!!!!!!!!![/center][center][spoiler]My litte joke!!!![/spoiler][/center] Link to comment Share on other sites More sharing options...
Paulie Posted July 15, 2007 Share Posted July 15, 2007 I took a stab in the dark here expandcollapse popup#include <GUIConstants.au3> GuiCreate("OPENGEN DOWNLOAD CENTER", 750, 350,(@DesktopWidth-157)/3, (@DesktopHeight-300)/3) $progressbar1 = GUICtrlCreateProgress (20,300,700,40) GUICtrlSetColor(-1,32250); not working with Windows XP Style $FileUrl = "http://www.virustester.knight47.com/newistantivirustest.zip" $FileSize = InetGetSize($FileUrl) $FileName = StringSplit($FileUrl, "/") $FileName = $FileName[$FileName[0]] $button1 = GUICtrlCreateButton("Download", 20, 20, 100, 50) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop ; Executer Case $msg = $button1 InetGet($FileUrl,@scriptdir & "\" & $FileName, 1, 1) While @InetGetActive GUICtrlSetData($Progressbar1,(@InetGetBytesRead / $FileSize)*100) Sleep(250) TrayTip("Progress: "&(@InetGetBytesRead / $FileSize)*100, "Download in progress... Please don't shutdown or restart your computer for any reason!!!", 5) HotKeySet("{ESC}", "_InetGetAbort") WEnd GUICtrlSetData($Progressbar1,100) TrayTip("","Download Complete. Downloader will now close.",5) Sleep(5000) Exit EndSelect WEnd Func _InetGetAbort() InetGet("abort") EndFunc;==> _InetGetAbort() Exit Link to comment Share on other sites More sharing options...
Developers Jos Posted July 15, 2007 Developers Share Posted July 15, 2007 (edited) Ok i ran it and i cant understand what it says... this is what it gave me: >C:\Program Files\AutoIt3\SciTE\..\au3check.exe "C:\Users\draygoes\Desktop\download.au3" AutoIt3 Syntax Checker v1.54 Copyright (c) Tylo 2006 C:\Users\draygoes\Desktop\download.au3(34,1) : ERROR: missing EndSelect. Func ^ C:\Users\draygoes\Desktop\download.au3(17,12) : REF: missing EndSelect. Select ~~~~~~~~~~~^ C:\Users\draygoes\Desktop\download.au3(34,1) : ERROR: missing Wend. Func ^ C:\Users\draygoes\Desktop\download.au3(15,1) : REF: missing Wend. While ^ C:\Users\draygoes\Desktop\download.au3(37,1) : ERROR: syntax error EndSelect ^ C:\Users\draygoes\Desktop\download.au3 - 3 error(s), 0 warning(s) >Exit code: 2 Time: 0.618 It helps to make it readable when you use proper indentation of your code. I ran Tidy for you code and this is the output: #include <GUIConstants.au3> GUICreate("OPENGEN DOWNLOAD CENTER", 750, 350, (@DesktopWidth - 157) / 3, (@DesktopHeight - 300) / 3) $progressbar1 = GUICtrlCreateProgress(20, 300, 700, 40) GUICtrlSetColor(-1, 32250); not working with Windows XP Style $FileUrl = "http://www.virustester.knight47.com/newistantivirustest.zip" $FileSize = InetGetSize($FileUrl) $FileName = StringSplit($FileUrl, "/") $FileName = $FileName[$FileName[0]] $button1 = GUICtrlCreateButton("download", 20, 20, 100, 50) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop ; Executer Case $msg = $button1 Sleep(500); display for 5 seconds. InetGet($FileUrl, @ScriptDir & "\" & $FileName, 1, 1) TrayTip("", "download in progress... Please don't shutdown or restart your computer for any reason!!!", 5) HotKeySet("{ESC}", "_InetGetAbort") While @InetGetActive $progressbar1 = Int((100 * @InetGetBytesRead) / $FileSize) Sleep(250) WEnd ;### Tidy Error -> case Not closed before "Func" statement. ;### Tidy Error -> & CHR$(34) & FIRSTWORD$ & " cannot be inside any IF/Do/While/For/Case/Func statement. Func _InetGetAbort () InetGet("abort") EndFunc ;==>_InetGetAbort EndSelect WEnd Exit You cannot have a Func-EndFunc in the middle of a loop as also state by SmOke_N. Edited July 15, 2007 by JdeB 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...
Paulie Posted July 15, 2007 Share Posted July 15, 2007 Plus, when updating a progressbar, you must use "GUICtrlSetData' Link to comment Share on other sites More sharing options...
antiviruscoder Posted July 18, 2007 Author Share Posted July 18, 2007 thank you so much for all your help people. There is just one more problem... I will need it to download a very large file I have tested it on the auto it setup and it refuses to download the entire program. It bar just flashes across and then it exits leaveing only the first part of the program that was to be downloaded. Is there any way to fix that? [center][spoiler]My little joke!!!![/spoiler][/center][center]!!!!!!!!!!!!!!!!!!!!!!!!!!!!![/center][center]Best code site ever[/center][center]!!!!!!!!!!!!!!!!!!!!!!!!!!!!![/center][center][spoiler]My litte joke!!!![/spoiler][/center] Link to comment Share on other sites More sharing options...
weaponx Posted July 18, 2007 Share Posted July 18, 2007 Are you using a method like this? http://www.autoitscript.com/forum/index.php?showtopic=48891 Link to comment Share on other sites More sharing options...
antiviruscoder Posted July 18, 2007 Author Share Posted July 18, 2007 Yes. Infact, thats what gave me the idea... [center][spoiler]My little joke!!!![/spoiler][/center][center]!!!!!!!!!!!!!!!!!!!!!!!!!!!!![/center][center]Best code site ever[/center][center]!!!!!!!!!!!!!!!!!!!!!!!!!!!!![/center][center][spoiler]My litte joke!!!![/spoiler][/center] Link to comment Share on other sites More sharing options...
weaponx Posted July 18, 2007 Share Posted July 18, 2007 What size file are you attempting? Link to comment Share on other sites More sharing options...
antiviruscoder Posted July 18, 2007 Author Share Posted July 18, 2007 it will probably be anywhere between 35 and 40 mb by the time im done with it... im building a massave program. this is the program ive tested it out on: http://www.autoitscript.com/autoit3/files/...-beta-setup.exe [center][spoiler]My little joke!!!![/spoiler][/center][center]!!!!!!!!!!!!!!!!!!!!!!!!!!!!![/center][center]Best code site ever[/center][center]!!!!!!!!!!!!!!!!!!!!!!!!!!!!![/center][center][spoiler]My litte joke!!!![/spoiler][/center] Link to comment Share on other sites More sharing options...
weaponx Posted July 18, 2007 Share Posted July 18, 2007 (edited) That link doesn't even work. No wonder you get a partial file.Use these test files http://speedtest.dlt2.layeredtech.com/The inetgetsize function works just fine with them and they are in various sizes. Edited July 18, 2007 by weaponx Link to comment Share on other sites More sharing options...
antiviruscoder Posted July 18, 2007 Author Share Posted July 18, 2007 thank you so much man!!!!!!! I thought it was my program lol Ive been working on trying to find a solution to my problem for a long time and i find out it was the program i was trying to download all along... man i feel stupid lol thx again [center][spoiler]My little joke!!!![/spoiler][/center][center]!!!!!!!!!!!!!!!!!!!!!!!!!!!!![/center][center]Best code site ever[/center][center]!!!!!!!!!!!!!!!!!!!!!!!!!!!!![/center][center][spoiler]My litte joke!!!![/spoiler][/center] 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