Jump to content

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Posted (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:

  1. rename current exe to _old.exe (yes, the exe file is able to rename itself)
  2. copy the new exe to the local computer
  3. run the new exe
Func 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 by Marc
typo

It's my job to comfort the disturbed and to disturb the comfortable.
My Projects: Profiler, MakeSFX, UserInfo

Share this post


Link to post
Share on other sites

A good place to start is this thread:

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

Awesome thank you all I will start working on this and post back.

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

×
×
  • Create New...