Auto Update

Auto Update is a utility that can be used by any program to retrieve software updates from the World Wide Web. The calling program need not support Internet access to be able to make use of Auto Update. Auto Update consists of a single executable which is invoked with command-line parameters which tell it what to do. It will eventually support a callable library as well. AutoUpdate is in the public domain.

Download Windows 32 AutoUpdate.exe

Overview

The general operation of the program is to download a command file from the internet. This is compared with a cached local copy. If they are the same, there is no new update and the program exits silently. Otherwise it processes the commands in the download file which indicate files to copy from the internet and/or a file to execute on the local machine. If any copy operation fails, the program will exit silently at that point - the remaining commands will be ignored. Note: currently the way the program operates, the download file is copied to the cached local copy before processing begins. So if the processing aborts, the next time AutoUpdate is called for the same file it will exit, thinking that the update was already done. This will be addressed in a later version.

Typical usage is to create a update installer application, have the download file direct AutoUpdate to copy this application to the local computer and then execute it.

 

Command Line

Auto Update takes a command line of the form:

url path {translations} {/{NO}ASK{=text}}

where "url" is the url of a file on the Internet. Note that Auto Update only supports HTTP access to files at this time. This is also known as the "download file". If this file cannot be downloaded, AutoUpdate exits silently.

"path" is the local path and filename of where the download file will be cached. If this file already exists and is an exact match for the download file, then there is no change and AutoUpdate will exit silently.

"translations" is an optional translation file used in conjunction with the download file contents.

By default, AutoUpdate will prompt the user for whether or not they wish to do the download. /NOASK can be used to do the download without querying the user. The default query text is of the form: "Do you want to update from x?", where "x" is the url from the command line. However, custom query text can be specified after the switch. If the user responds with "No" when prompted, the AutoUpdate program will immediately exit.

Note that the parameters are separated by spaces, thus if any of the parameters contain embedded spaces, the entire parameter must be delimited with a quote. Either single quotes (') or double quotes (") can be used, but the same type must be used at the beginning and end. In this way, a quote of one type can be embedded within a parameter delimited by the other type. Further, since slashes are used for switches, any parameters with embedded slashes (such as url) must also be delimited by quotes.

Example command lines:

"http://www.mysite.com/updates.txt" "c:\Program Files\MyProg\updates.txt" "c:\Program Files\MyProg\xlate.txt" /ASK="There is a new version of MyProg available. Do you want to download it?"

"http://www.mysite.com/updates.txt" 'c:\Program Files\MyProg\updates.txt' /ASK

"http://www.mysite.com/updates.txt" c:\myprog.txt /NOASK

Download File Format

The download file is a text file where each line is a command for AutoUpdate to process. There are two forms:

form1

target=source

form2

execute path

where "target" is the path and filename on the local machine to copy the source file to. "source" is an internet url of a file to download. Note that only HTTP is supported at this time. "path" is the path and filename on the local machine of a program to execute. This must be a binary executable file. The case of "execute" is ignored.

Note that the location on the local machine to copy files to is most likely installation-dependant and therefore cannot be hardcoded in the target specification. The Translation file is used to provide a way to deal with this (see next section).

Example download file:

<programdir>Setup.exe=http://www.mysite.com/Setup.exe
execute <programdir>Setup.exe

In this example, AutoUpdate will copy http://www.mysite.com/Setup.exe to <programdir>Setup.exe. It will then execute <programdir>Setup.exe. This example assumes a translation file which provides a translation for "<programdir>"

 

Translation File Format

The optional translation file is used to make sure that files are copied to the correct local path. Since installations may vary between computers, the download file cannot be specific as to the drive or path on the local machine. Thus, the calling application must create a translation file that will support the contents of the download file.

The translation file is a text file where each line indicates one text substitution to perform in the download file. Most typically, this will include a translation for the program directory of the calling application. Each line in the translation file is of the form:

string=substitution

where "string" is the text in the download file that is to be changed and "substitution" is the text to replace "string" with. If "string" contains any embedded equal signs (=), it must be delimited by quotes. Either single quotes (') or double quotes (") can be used, but the same type must be used at the beginning and end. In this way, a quote of one type can be embedded within a string delimited by the other type.

Example translation file:

<programdir>=c:\Program Files\MyProg\

Used with the above example download file, the operation of AutoUpdate would be to copy http://www.mysite.com/Setup.exe to c:\Program Files\MyProg\Setup.exe and then execute c:\Program Files\MyProg\Setup.exe.

 

AutoUpdate Sources

The source code for the Windows 32 version of AutoUpdate is available here. Note that the source is written in Delphi and makes use of a subroutine library available at http://www.conroyhome.net/alan/source/subroutines.

Download Windows 32 AutoUpdate sources