(imported comment written by jessewk)
Ah yes, the wonders of versioning on Mac OS X.
Here are a couple more variations to try. You’ll probably want to mix them up a little:
(name of it, (if exists version of it then version of it as string else “”), (if exists bundle version of it then bundle version of it as string else “”)) of applications whose (pathname of it starts with pathname of applications folder)
(name of it, (if exists version of it then version of it as string else “”), (if exists bundle version of it then bundle version of it as string else “”), (if exist folder (pathname of it) AND exists string “CFBundleGetInfoString” of global dictionary of bundle of folder (pathname of it) then string “CFBundleGetInfoString” of global dictionary of bundle of folder (pathname of it) else “”)) of applications whose (pathname of it starts with pathname of applications folder)
Note that there are several other places that version can be stored in a bundle, including CFBundleShortVersionString, SourceVersion, and BuildVersion.
When Apple’s Installer checks for versions, it uses the following logic (and BigFix does the same):
To create a version from a version.plist file, Installer computes a 5-tuple from three keys in the "version.plist file: the CFBundleShortVersionString key, the SourceVersion key, and the BuildVersion key. For a 5-tuple of the form a.b.c.d.e, a.b.c is obtained from the value of CFBundleShortVersionString, d is obtained from the value of SourceVersion, and e is obtained from the value of BuildVersion. If any key is missing, the corresponding element is replaced with 0.
The fourth and fifth elements of the 5-tuple are created from the integer values of SourceVersion and BuildVersion. If the only difference between two submissions is that the SourceVersion field changed from 1.8.4GMc2 to 1.8.4GMc3, Installer treats them as the same because the integer values of both of these is 1. For Installer to be able to distinguish between two copies of a bundle, either the SourceVersion needs to change for each submission, or the CFBundleShortVersionString needs to change, such that the integer values can be differentiated.