Apocalypse Posted April 16, 2007 Share Posted April 16, 2007 I wrote a funtion that checks online for available updates to the program and if so, downloads and installs those updates. I forgot to add a check to make sure the internet is reachable and when I used the program on a computer without internet, the program took forever to get past the update function. Looking around the forums I found two ways to check if there is a reason to continue updating.Method One:Update() DoOtherStuff() Func Update() $dl = InetGet("http://www.website.com/version.ini", @DesktopDir & "/version.ini", 0, 1) If $dl == 0 Then FileDelete(@DesktopDir & "/version.ini") Return EndIf $chk = IniRead(@DesktopDir & "/version.ini", "version", "ver", 0) If $chk > FileGetVersion(@ScriptFullPath) Then ... ... ... Else FileDelete(@DesktopDir & "/version.ini") EndIf EndFuncMethod Two:Update() DoOtherStuff() Func Update() InetGet("http://www.website.com/version.ini", @DesktopDir & "/version.ini", 0, 1) If @error Then FileDelete(@DesktopDir & "/version.ini") Return EndIf $chk = IniRead(@DesktopDir & "/version.ini", "version", "ver", 0) If $chk > FileGetVersion(@ScriptFullPath) Then ... ... ... Else FileDelete(@DesktopDir & "/version.ini") EndIf EndFuncWhich is the prefered method? Link to comment Share on other sites More sharing options...
BrettF Posted April 16, 2007 Share Posted April 16, 2007 I would have to say the first one. Although, they both are very simmilar..... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! 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