Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
checking for new versions of your app
Is this function now obsolete because of packaging? Perhaps, but your user might still enjoy being reminded to update.

On a server under your control, put a one-line text file containing the current available version. Like this:


Use Pe to generate this. StyledEdit has this irritating habit of ending the file with a newline even if you didn't put one there. If there are two lines you will confuse the routine. Do not hit Enter after the text! The lowercase v is also important here.It gives us a quick-and-dirty way to check connectivity.

There are two global variables involved. AppVersion$ is the version set in the program itself and used in the About box and such. UpdateFile$ is the full URL to the one-line text file. They don't HAVE to be global, of course, but I happen to use these variables elsewhere

sub FindUpdates()
    local version$,selector
    version$ = system$("curl --connect-timeout 1 " + UpdateFile$)
    if left$(version$,1)<>"v" then
        alert "Unable to connect to update server!", "OK", "warning"
    if version$ = AppVersion$ then
        alert "You have the latest version of this program.", "OK", "info"
        selector = alert "A newer version of this program is available. Take  a look?", "Yes", "No", "", "info"
        if selector = 1 launch ""
end sub

Now you just need to remember to update UpdateFile$ whenever you post up a new version.

PS. Jim does this forum have a "Code" function?

A possible tweak to this might be that the app itself notes that its version number is higher than the one in UpdateFile$ and auto-updates the remote file. Must look into that.

Messages In This Thread
checking for new versions of your app - by clasqm - 07-06-2015, 10:40 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)
Free Web Hosting