Nunos Posted May 24, 2019 Posted May 24, 2019 Good day all, I am trying to find out what approach you guys take to update your app say from a file or web server to make sure the latest version is always being used. I looked through the help file and UDF's but I am not seeing anything for this, perhaps I am looking for the wrong terms.
Marc Posted May 25, 2019 Posted May 25, 2019 (edited) Well, I have a location on one of our servers in the LAN and on every start the local version is compared to the version on the server. General way of updating the compiled exe is: rename current exe to _old.exe (yes, the exe file is able to rename itself) copy the new exe to the local computer run the new exe expandcollapse popupFunc Updateholen() Local $updatepfad = "\\server\myprogram\" ; Folder to get the Updates Local $updatequelle = $updatepfad & "myfile.exe" ; FileName to check for Local $tmp1 = "" Local $tmp2 = "" If FileExists(@ScriptDir & "\myfile_old.exe") Then FileDelete(@ScriptDir & "\myfile_old.exe") ; delete possibly existing old version If Not @Compiled Then Return ; only try to update if started as a compiled exe If @AutoItX64 = 1 Then $updatequelle = $updatepfad & "myfile_x64.exe" If Not Ping("server", 50) Then Return ; if server is not online, update can not be retrieved If FileExists($updatequelle) Then $tmp1 = FileGetTime($updatequelle, 0, 1) $tmp2 = FileGetTime(@AutoItExe, 0, 1) If $tmp1 > $tmp2 Then ; rename the currently running exe file $tmp1 = FileMove(@AutoItExe, @ScriptDir & "\userinfo_alt.exe") If $tmp1 <> 1 Then MsgBox(16, "Problem", "Could not rename the running exe") Exit EndIf ; copy the new exe file to our PC $tmp1 = FileCopy($updatequelle, @AutoItExe) If $tmp1 <> 1 Then MsgBox(16, "Problem", "Could not copy the update") Exit EndIf ; notify user about the update and display version history If FileExists($updatepfad & "history.htm") Then ShellExecute($updatepfad & "history.htm") Run(@AutoItExe) Exit EndIf EndIf EndFunc ;==>Updateholen Edited May 25, 2019 by Marc typo Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)
water Posted May 25, 2019 Posted May 25, 2019 A good place to start is this thread: My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Nunos Posted May 25, 2019 Author Posted May 25, 2019 Awesome thank you all I will start working on this and post back.
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