Sign in to follow this  
Followers 0
quake101

Need help with my updater

7 posts in this topic

Ok, I have built an updater for my current project that is very basic. It checks for a new version via the web then downloads it...blah blah blah....

My question for you guys is, how do you guys update your programs? I had a small problem with pulling the "current" version of the program to compare it to the remote (web) version. My program does not use any registry settings or ini files, so I was thinking something along the lines of internal messages (from main program to updater). Let me know what you guys use and help me get past this small bump so I can get back to coding the good stuff. (I don't know why the little things like this bug me so much, but I spend way too much time on things like this...)

Share this post


Link to post
Share on other sites



You could have a version.txt in your web server and download those few bytes and read it to see what version is uploaded at the web server. And of course in your program you'll have a constant to keep track of the current version.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Getting the current version from the web isn't the question... I was asking what's the best/quickest/ect way of storing and reading your program version from an updater program with out using reg or files. :D

Just trying to get an idea of what every is using for their updater with examples.

I was thinking about internal messages but didn't know how I should do that...

Edited by quake101

Share this post


Link to post
Share on other sites

Here's what I do:

$currentver=1.4
    inetget("http://www.llewxamnai.com/version.ini",@tempdir&"\techver.ini",1)
    $onlinever=IniRead(@tempdir&"\techver.ini","Version","Version","unknown")
    $15changes=IniRead(@tempdir&"\techver.ini","Update","1.5","unknown")
    $16changes=IniRead(@tempdir&"\techver.ini","Update","1.6","unknown")
    if $onlinever>$currentver then
        $dlsize=inetgetsize("http://www.llewxamnai.com/essentials.exe")
        $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&"(the download is "&round(($dlsize/1000000),2)&"MB)"&@CRLF&@CRLF&$16changes&@CRLF&@CRLF&$15changes)
        if $getnew=6 Then
            $wheretosave=FileSelectFolder("Please choose a folder to save the installer","",1)
            $status=GUICreate("Download Progress",250,60)
            $progress=GUICtrlCreateProgress(5,5,240,20)
            $howfar=GUICtrlCreateLabel("",5,35,50,20,$ss_right)
            $howbig=GUICtrlCreateLabel("",55,35,70,20,$SS_LEFT)
            $howfast=GUICtrlCreateLabel("",155,35,90,20,$SS_left)
            GUISetState(@sw_show,$status)
            InetGet("http://www.llewxamnai.com/essentials.exe",$wheretosave&"\essentials.exe",1,1)
            GUICtrlSetData($howbig,"MB/"&round(($dlsize/1000000),2)&"MB")
            $toshow=TimerInit()
            local $sofar
            Do
                if TimerDiff($toshow)>200 Then ;refresh every .2 seconds
                    $msg = GUIGetMsg()
                    if $msg = $GUI_EVENT_CLOSE then Exit
                    $lastlook=$sofar
                    $sofar=@InetGetBytesRead
                    $speed=($sofar-$lastlook)*5                 
                    GUICtrlSetData($progress,($sofar/$dlsize)*99)
                    GUICtrlSetData($howfar,round(($sofar/1000000),2))
                    $toshow=TimerInit()
                EndIf
            until $dlsize=$sofar
            GUIDelete($status)
            msgbox(0,"Done","Finished downloading the new version.  This installer will now exit, please run """&$wheretosave&"\essentials.exe"" to unpack the new installation.  You may also burn it to a CD or transfer it to a USB flash drive for future installation.")
            Exit
        EndIf
    EndIf

So, just have a variable locally in the script and compare it to an INI online. When you make a new version of the app:

Update the version number in the script

Post it to your server

Update the INI on the server with the new version number.

I like having my own GUI so the user doesn't have any copy-paste to browser nonsense, and they don't see the server name....

BTW,the app linked was made in AutoIt, enjoy :D

Hopefully this is what you're after.

Ian


My projects:

  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized site agent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.
  • MyDirStat - Lists number and size of files on a drive or specified path, allows for deletion within the app.
  • 2048 Game - My version of 2048, fun tile game.
  • Juice Lab - Ecigarette liquid making calculator.
  • Data Protector - Secure notes to save sensitive information.
  • VHD Footer - Add a footer to a forensic hard drive image to allow it to be mounted or used as a virtual machine hard drive.
  • Find in File - Searches files containing a specified phrase.

Share this post


Link to post
Share on other sites

Getting the current version from the web isn't the question... I was asking what's the best/quickest/ect way of storing and reading your program version from an updater program with out using reg or files. :D

Just trying to get an idea of what every is using for their updater with examples.

I was thinking about internal messages but didn't know how I should do that...

Have a look at FileGetVersion(@ScriptName).

If you launch the updater from within your program, just pass the fileversion along and go from there eg:

Local $sProgramVers = FileGetVersion(@ScriptName) ; variable containing the programs version number
Updater(sProgramVers)

If you don't launch the updater from within the program, try using something like FileGetVersion("C:\myprog.exe") from within the updater.

Share this post


Link to post
Share on other sites

llewxam, thank you for your example, I was doing the same thing with mine thought there might be a better way.

PartyPooper, thank you, I've never thought about using FileGetVersion and I think this is much better then my current method. :D

Share this post


Link to post
Share on other sites

Your welcome :D

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