Sl4ck3r Posted April 20, 2010 Share Posted April 20, 2010 I have an auto updater that I need help with. I have figured out how to get the download to work but cannot get the dialog with the progress to work correctly. #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <Array.au3> #include <File.au3> If FileExists(@TempDir&"\version.ini") Then FileDelete(@TempDir&"\version.ini") EndIf $currentver=2.0 InetGet("ftp://user:password@my.ftp.site/IT_SiteSupport/hii_usb/version.ini",@TempDir&"\version.ini",1) $updatefile=("ftp://user:password@my.ftp.site/IT_SiteSupport/hii_usb/usbupdate.exe") $onlinever=IniRead(@TempDir & "\version.ini","Version","Version","unknown") $20changes=IniRead(@TempDir & "\version.ini","Update","2.0","unknown") if $onlinever>$currentver then $dlsize=InetGetSize($updatefile) $getnew=msgbox(4,"Update Available","Version "&$onlinever&" is available online, you currently have version "&$currentver&". Would you like to download the latest version now?"&@CRLF&@CRLF&"Note - This is a USB update only not an image update!"&@crlf&"(the download is "&round(($dlsize/1000000),2)&"MB)"&@CRLF&@CRLF&$20changes) if $getnew=6 Then $wheretosave=FileSelectFolder("Please choose a folder to save the updater","",1) InetGet($updatefile, $wheretosave&"\usbupdate.exe",1) EndIf $hDownload=$wheretosave&"\usbupdate.exe" Do Sleep(250) Until InetGetInfo($hDownload, 2) ; Check if the download is complete. Local $aData = InetGetInfo($hDownload, 0) ; Get all information. InetClose($hDownload) ; Close the handle to release resources. MsgBox(0, "", "Bytes read: " & $aData[0] & @CRLF & _ "Size: " & $aData[1] & @CRLF & _ "Complete?: " & $aData[2] & @CRLF & _ "Successful?: " & $aData[3] & @CRLF & _ "@error: " & $aData[4] & @CRLF & _ "@extended: " & $aData[5] & @CRLF) msgbox(0,"Done","Finished downloading the new version. This installer will now exit. Please reboot for changes to apply") Exit EndIf Link to comment Share on other sites More sharing options...
Sl4ck3r Posted April 22, 2010 Author Share Posted April 22, 2010 Nevermind I figured it out. I was unaware that the popup occurs after the download completes. 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