Version and plist version?

We build a lot of in house applications from small file mover type things to complex stuff that lays out ads in the magazines. We’re trying to get a handle on the maintenance of them by creating a auto updater similar to what iTunes does when a new version is available. To accomplish this we placed each application into a database, one field of which is the version (what the developer hard codes as the version). We then change the info.plist xml file to reflect the new version and updating the database (you can do it through an intranet site (PHP & form) or a desktop AppleScript app.

I’m working on when the apps launch they get their name and version and then check the database to see if they are a version less than the latest. Which leads me to two questions:

How do I get the data off the info.plist file and what is the difference between the tag on that file and the version that is returned when you do this:


set appVersion to version

In my app the appVersion returns 1.10.7 but on the info.plist file the tag is

Thanks for any help.

Just an addendum - I can access the plist file:

set plistPath to (path to me) & “Contents:Info.plist” as string

and read it. I’m still curious as to the difference between what is returned by version and the value of the attribute of the plist tag.

Thanks

Hi,

the is the version of Apple’s property list specification.

This example creates a list of all running applications with its name and version

tell application "System Events" to set apps to file of processes whose background only is false
set theList to {}
repeat with oneApp in apps
	set appName to name of (info for oneApp)
	try
		set InfoPath to quoted form of (POSIX path of oneApp & "Contents/Info")
		set end of theList to {appName, do shell script "defaults read " & InfoPath & " CFBundleShortVersionString"}
	end try
end repeat
theList -- list of running applications {name, version}

Hi Stefan, thanks for the reply. I kind of understood that but what is the difference between the version on the property list and the version returned from within the app?

set appVersion to version

version is a global property of AppleScript and contains always the current AppleScript version

to get the version of an application you have three ways with the same result

property appItunes : "/Applications/iTunes.app"

set v1 to version of application "iTunes"
set v2 to do shell script "defaults read /Applications/iTunes.app/Contents/Info CFBundleShortVersionString"
set v3 to short version of (info for POSIX file appItunes as alias)

the plist version (1.0) is the version of the property list specification itself,
i.e. the file structure rules of arrays, keys, dictionaries etc.

Thanks Stefan!