how to add the automatic update of my executable with Inno_setup

289 views Asked by At

I create my executable with inno-setup but I want it to notify the users of the availability of a new version lorce it is isponible

1

There are 1 answers

0
Rolf of Saxony On

With my applications, I do it manually.
I have a "Check Version" option in the "Help" menu, although, obviously it can be done automatically on start up.
A simple method is to have your code contain a version variable and your repository contain a text file with the current version, along with the new code/binary. Then it's a simple matter of reading the contents of that text file, comparing it against the current version and either informing the user that there is a newer version or downloading it and installing it, although it's probably best to let the user make that decision for themselves.
Here is the guts of some code to get the current version from the repository.

   def GetVersion(self, event):
        from requests import get
        busy = wx.BusyInfo("Checking SourceForge please wait...",self)
        wx.GetApp().Yield()
        try:
            RawInfo = get('https://sourceforge.net/projects/footswitch2/files/Latest_Version.txt/download', headers={'User-Agent':'footswitch2'})
            del busy
        except Exception as e:
            wx.MessageBox('Version information is unavailable or unable to connect to\nhttps://sourceforge.net/projects/footswitch2/', 'Footswitch2 Version '+str(Version[0]), wx.OK | wx.ICON_INFORMATION)
            del busy
            return
        TextInfo = RawInfo.content.decode('UTF-8')

Now you have TextInfo unpack/split it and compare it to your variable Version (the current version number) and progress from there.
It isn't fancy or sophisticated but it is simple and pretty much foolproof.