gcue Posted July 15, 2009 Share Posted July 15, 2009 (edited) i have a script that detects if theres a newer version (checks on a lan share) (taken from script that gets updated) expandcollapse popupFunc Auto_UpdateCheck() If Not FileExists("\\serverpath") Then MsgBox(262144, "Check for Updates", "\\serverpath is not accessible.") Return EndIf $search = FileFindFirstFile("\\serverpath\scriptname*.exe") If $search = -1 Then MsgBox(262144, "Check for Updates", "Script cannot be found in \\serverpath.") Return EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop $recent_ver = StringTrimRight($file, 4) WEnd If $ver < $recent_ver Then Get_Update() EndIf EndFunc Func Get_Update() If FileExists(@ScriptDir & "\_updater.exe") Then FileMove(@ScriptDir & "\_updater.exe", @ScriptDir & "\updater.exe", 1) EndIf If FileExists(@ScriptDir & "\updater.exe") Then Run(@ScriptDir & "\updater.exe") Exit Else MsgBox(262144, "Script", "UPDATER.EXE was not found in " & @ScriptDir & @CRLF & _ "Please manually extract/replace your folder with server copy.") _IECreate("file://serverpath", 0, 1, 0) EndIf EndFunc ;==>Get_Update the file on the server is a self extracting executable that has the new version of the script along with updater.exe (current updater) and _updater.exe (new updater.exe) _updater.exe gets renamed to updater.exe (so far the only way i can think of on how to update the updater) problem is.. new updater doesn’t run till the next update. because updater is in use, when its trying to replace it! can anyone think of a more clever way to allow for not only the updating but also the replacement of the updater itself? Edited July 15, 2009 by gcue Link to comment Share on other sites More sharing options...
DW1 Posted July 15, 2009 Share Posted July 15, 2009 When you detect _updater being present, couldn't you launch another script (that simply handles the file replacement) that will wait until the main is no longer loaded? AutoIt3 Online Help Link to comment Share on other sites More sharing options...
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