jasny Posted January 29, 2011 Posted January 29, 2011 (edited) Hello, 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 January 29, 2011 by jasny
JohnOne Posted January 29, 2011 Posted January 29, 2011 Yes, its all possible, there are umpteen examples of similar things if you search. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
twitchyliquid64 Posted January 30, 2011 Posted January 30, 2011 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
jasny Posted January 30, 2011 Author Posted January 30, 2011 Can you "hint" the search keywords how to do it ?
JohnOne Posted January 30, 2011 Posted January 30, 2011 http. FileRead() InetRead() InetGet() ShellExecute()/Run() SelfDelete() AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
shai Posted January 30, 2011 Posted January 30, 2011 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 self_update() EndIf 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" FileWrite($batchPath,$batchFile) Run($batchPath, "", @SW_HIDE) Exit EndFunc change http://www.yoursite.com/downloads to your sile and yourapp.exe to your app name
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now