


|
|
Automatically Reflecting Version in Product Name
Often it’s convenient to include version number in
the product name, for instance Cool Product 1.0 . But then, whenever
there’s new version, the name needs to be corrected accordingly, to
reflect increased version number. Can this be made automatically? This
becomes especially desirable feature when installations are produced by
some automated process, for example when each customer receives an
individual installation.
To accomplish this, we need to create a custom
action that will reach into the MSI database, fetch the version of the
“main” executable, and append it to the product name. Here’s the script
to do it, assuming that the name of the “main” executable is
coolproduct.exe .
-
Set v =
Database.OpenView("select Version from `File` WHERE `FileName` =
' coolproduct.exe'")
-
v.Execute
-
Set r = v.Fetch
-
Version = r.StringData(1)
-
OldPN =
Session.Property("ProductName")
-
If right(OldPN, Len(Version))<>
Version Then Session.Property("ProductName") =
Session.Property("ProductName") & " " & Version
This custom action must be placed in execute
sequence. It can also be placed in user sequence, if the dialogs are
using ProductName property in titles and such. |