Jump to content
Sign in to follow this  

Auto Updater

Recommended Posts



I'm wondering how to write script which :

- Check if new version is available file ( via http or ftp )

- Downloads it

- Overwrites itselfs, Closes itself and executes downloaded one.

I don't know if it is possible due to security reasons, but did you heard about some kind of updaters written in autoit ?

Best Regards

Edited by jasny

Share this post

Link to post
Share on other sites

I've never heard of a program being able to overwrite itself, I've always had to have a separate program to do the update

ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Share this post

Link to post
Share on other sites

i using this code and it work for me

put this code in your script:

If InetGetSize("http://www.yoursite.com/downloads/yourapp.exe") <> FileGetSize(@ScriptFullPath) Then 

change http://www.yoursite.com/downloads/yourapp.exe to your site location.

and add this function to your script

Func self_update()
        Global $complete_hlcfile_master_data_path = "http://www.yoursite.com/downloads"
        InetGet($complete_hlcfile_master_data_path & "\yourapp.exe", @ScriptFullPath & ".new") ;changed the name of the new file.
        Local $batchPath = @ScriptDir & '\update.bat'
        Local $batchFile =  "@echo off"& @CRLF _
                          & "ping localhost -n 2 > nul" & @CRLF _ ;not sure what you're doing here. Giving the script time to exit?
                          & ":loop" & @CRLF _ ;specify the start of a zone
                          & 'del /Q "' & @ScriptFullPath & '"' & @CRLF _ ;the quotes are needed for long filepaths, and filepaths with spaces. The @SciptfullPath is for flexibility
                          & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ ;if the delete failed, try again
                          & 'move "' & @ScriptFullPath & '.new" "' & @ScriptFullPath & '"' & @CRLF _ ;this is why I changed the new file's name.
                          & 'start "' & @ScriptFullPath & '"' & @CRLF _
                          & 'del /Q "' & $batchPath & '"' & @CRLF _
                          & "exit"      
        Run($batchPath, "", @SW_HIDE)

change http://www.yoursite.com/downloads to your sile and yourapp.exe to your app name

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.