Jump to content

Help with an autoupdater


Recommended Posts

Hi.I'm new in using autoit and i want to make an auto updater for my program.

I am using a script found on this forum.

This is it:

$currentver=1.4
    inetget("http://www.vipersoft.co.cc/test/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.vipersoft.co.cc/test/program.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.vipersoft.co.cc/program.exe",$wheretosave&"\program.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&"\program.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

This is the script but is an error at line 25.

Can you help me to fix it?Or can you give me another working script?

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
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...