Sign in to follow this  
Followers 0
bomboa

Update checker?

3 posts in this topic

Hey, first I want to say thanks for the help, I'm new but everytime I have posted someone has pointed out something simple I missed. Anyways what I want to do is have my script check my website to see if I posted a new version on startup, and maybe prompt to goto my site. Is this possible? I have NO idea on how to go about it. Thanks.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hey, first I want to say thanks for the help, I'm new but everytime I have posted someone has pointed out something simple I missed. Anyways what I want to do is have my script check my website to see if I posted a new version on startup, and maybe prompt to goto my site. Is this possible? I have NO idea on how to go about it. Thanks.

Just get obj in IE and match the version code, if not then go to yourwebsite with IEOpen? Edited by Generator

Share this post


Link to post
Share on other sites

Just get obj in IE and match the version code, if not then go to yourwebsite with IEOpen?

Try this little thing I just cooked up :). It requires a .ini file on your server that contains the version, download link, and notes. This could be simpler, but I want one like this myself...

Example ini:

Update
V=0.0.0.0
NewLink=http://www.yoursite.com/update/downloadedupdate.exe
Note=See how cool this is???? :P

This will download download.au3 into the script dir.

_CheckForUpdates("http://www.yoursite.com/udate/update.ini", @ScriptDir & "\update.ini")

Func _CheckForUpdates($fileURL, $TempFileDir, $NewSaveDir = @ScriptDir)
    #include <GUIConstants.au3>
    $currentv = FileGetVersion(@ScriptFullPath)
    $inet = InetGet($fileURL, $TempFileDir, 1, 0)
    $newv = IniRead($TempFileDir, "Update", "V", "")
    If Not $currentv = $newv Then
        $ianser = MsgBox(4, "Update", "It appears your current version is out of date.  Would you like to update to version " & $newv & "?")
        If $ianser = 6 Then
            $link = IniRead($TempFileDir, "Update", "NewLink", "")
            $notes = IniRead($TempFileDir, "Update", "Note", "")
            $size = InetGetSize ($link)
            
            $Form1 = GUICreate("Updating", 265, 238, 193, 123)
            $Label1 = GUICtrlCreateLabel("Downloading Updates...", 6, 6, 147, 20)
            $Edit1 = GUICtrlCreateEdit("", 6, 30, 251, 119)
            GUICtrlSetData(-1, $notes)
            $Progress1 = GUICtrlCreateProgress(6, 156, 252, 21)
            GUICtrlSetLimit (-1, $size)
            $Label2 = GUICtrlCreateLabel("Downloaded 0\"&Int($size*1024)&"kb", 48, 180, 211, 20, $SS_RIGHT)
            $Button1 = GUICtrlCreateButton("Cancel", 180, 204, 75, 25, 0)
            GUISetState(@SW_SHOW)
            While 1
                $Msg = GUIGetMsg()
                Select
                    Case $Msg = $GUI_EVENT_CLOSE
                        Exit
                    Case $Msg = $Button1
                        If Not @InetGetBytesRead = $size Then
                            $ianswer = MsgBox (4, "Exit", "Are you sure you want to exit while an update is in progress?")
                            If $ianser = 6 Then
                                InetGet ("abort")
                                Exit
                            EndIf
                        Else
                            Exit
                        EndIf
                    Case @InetGetActive = 0
                        GUICtrlSetData ($Button1, "Close")
                        GuiCtrlSetData ($Label1, "Complete!")
                    Case @InetGetActive = 1
                        GUICtrlSetData ($Progress1, @InetGetBytesRead)
                        GUICtrlSetData ($Label2, "Downloaded "&INT(@InetGetBytesRead)&"\"&Int($size*1024)&"kb")
                EndSelect
            WEnd
        EndIf
    EndIf
EndFunc   ;==>_CheckForUpdates

The GUI has major flickering problems, with the cancel button, and the lable with the progress. Just an example on how it can be done :)

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0