Jump to content



Recommended Posts

Just edited Updater to make this work for my script.

will check for program

update and if there is ask if

user wants to update, then

runs Update(), which runs


has most of the same args as _INetUpdater()

; Function Name:    _INetUpdateCheck()
; Description:      A simple UDF that can be used for updating programs via the internet
;     removed       Includes a progress bar and an option to automatically update the running script.
; Version:
; Parameter(s):     $s_inu_CurrentVersion - current program version number
;                   $s_inu_WebSite - website containing version file and executable
;                   $h_inu_IniFileName - Ini file on website containing version number
;     removed       $h_inu_RemoteFileName - executable filename to be downloaded
;     removed       $h_inu_LocalFileName - executable filename to be saved. Default (-1) - same as Remote Filename
;     removed       $h_inu_LocalBatchFile - batch updater filename. Default (-1) - "INetUpdater.bat"
;     removed       $i_inu_AutoInstall - auto install after downloading 0=no, 1=yes.  Default (0) - manually install update
; Requirement(s):   AutoIt Beta > 3.1
;                   Version control file located on webserver
; Return Value(s):  On Success - Downloads and installs, if chosen, the update
;                   Modification does not include download or install but asks user if they would like to.
;                   On Failure - sets @ERROR = 1 for function parameter errors
;                              - sets @ERROR = 2 if internet/version file not be available
;                              - sets @ERROR = 3 if updating batch file cannot be created
; Forum(s):         http://www.autoitscript.com/forum/index.php?showtopic=20082
;            http://www.autoitscript.com/forum/index.php?showtopic=47429
; Author(s):        Original code - PartyPooper
;                   Modifications - Mast3rpyr0
Func _INetUpdateCheck($s_inu_CurrentVersion, $s_inu_WebSite, $h_inu_IniFileName)
    If $s_inu_CurrentVersion = "" Then SetError(1) ; user didn't set current program version.  Set @error = 1
    If $s_inu_WebSite = "" Then SetError(1) ; user didn't set website address.  Set @error = 1
    If $h_inu_IniFileName = "" Then SetError(1) ; user didn't set remote INI filename.  Set @error = 1
    If @error Then Return ; return to calling function with @error = 1
    Local $h_inu_GetVersFile = InetGet($s_inu_WebSite & "\" & $h_inu_IniFileName, @TempDir & "\" & $h_inu_IniFileName) ; download version file from web to temp dir
    If $h_inu_GetVersFile = 0 Then  ; version file or internet not available
        MsgBox(262160, "ERROR", "Update check failed.  Website/internet/version file not available at this time.")
        SetError(2) ; set @error to 2
        Return ; return to calling function with @error = 2
    Local $s_inu_LatestVersion = IniRead(@TempDir & "\" & $h_inu_IniFileName, "Program Version", "Vers", 0) ; grab latest version number
    FileDelete(@TempDir & "\" & $h_inu_IniFileName) ; delete downloaded version file - no longer needed
    If $s_inu_LatestVersion <> $s_inu_CurrentVersion Then ; check latest version number against current version number and update if needed
        $doUpdate = MsgBox(4, "Update Available", "There is a new Version of Game Launcher available. Would you like to download?")
        If $doUpdate == 6 Then
            Update() ; Function that will run _INetUpdater. Add this to source:
            Func Update()
            SplashTextOn("Program Name", "Checking for updates....", 250, 30, -1, -1, 0)
            _INetUpdater("Current version", "Website", "new version ini", "target file")
            EndFunc ;==>Update
    If $s_inu_CurrentVersion = $s_inu_LatestVersion Then MsgBox(262640, "Game Launcher", "Program is up to date.")
EndFunc ;==>_INetUpdateCheck
Edited by Mast3rpyr0
Link to comment
Share on other sites

  • 3 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...