Jump to content

Program Updater


Recommended Posts

Hi all,

How to make some sort of update script for my program? I tried the following:

#include <GUIConstants.au3>

GUICreate("My GUI")  ; will create a dialog box that when displayed is centered
$t1 = GUICtrlCreateLabel("", 10, 10, 130)
$t2 = GUICtrlCreateLabel("", 10, 25, 130)
$t3 = GUICtrlCreateLabel("", 10, 40, 130)
GUISetState (@SW_SHOW)       ; will display an empty dialog box

; Run the GUI until the dialog is closed
GUICtrlSetData($t1, "Searching for updates ....")
If FileExists("[url="file://\Serverupdates$instupdate.txt"]\\Server\updates$\instupdate.txt[/url]") Then
GUICtrlSetData($t2, "Getting Update File ....") 
FileCopy("[url="file://\Serverupdates$instupdate.txt"]\\Server\updates$\instupdate.txt[/url]", @TempDir & "\instupdate.txt", 1)
$read = FileReadLine(@TempDir & "\instupdate.txt", 1)
GUICtrlSetData($t3, "New Version: " & $read)
Else
MsgBox(64, "Updater", "No update available")
EndIf
While 1
 $msg = GUIGetMsg()
 
 If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

It works, but its to time-consuming. I think theres a better way to do it. Does somebody have an idea?

Link to comment
Share on other sites

The best method is probably to create a PAD file.

Just query Google for "Create PAD file"

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

i made auto update in my script, it is part of my code, maybe it help u

$next_version=("http://www.xxx.yyy.ab/program_0.2.rar")

Select
    
        Case $msg = $UpdateButton 
        $size=InetGetSize ( $next_version )
        if  $size<1 Then
        MsgBox(0, "Update", "No update avaiable")
        EndIf
            If $size>1 Then
            InetGet($next_version, "update.rar", 1, 1)
            While @InetGetActive
            TrayTip("Downloading", "kBytes = " & @InetGetBytesRead/1000, 10, 16)
            WEnd
        EndIf
    Case $msg == $Gui_Event_close
    SaveSettings ()
    Exit
EndSelect

i just need to remember write correct $next_version

Link to comment
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
 Share

  • Recently Browsing   0 members

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