Get CFBundleVersion

I need to get the version shown in the parentheses in the about window (CFBundleVersion?) into my script. I’ve tried getting version of main bundle, just version, etc. What’s the trick? Thanks!

Model: PowerBook G4 17" 1GHz
Browser: Safari 412
Operating System: Mac OS X (10.4)

Try this:

set CFBundleVersion to my read_default("CFBundleVersion")

on read_default(default_name)
	set my_path to POSIX path of (((path to me) as Unicode text) & "Contents:Info.plist")
	return call method "getPlistValue:forKey:" with parameters {my_path, default_name}
end read_default

Jon

Thanks, but the call method line seems to not be returning any value. I’ve checked to see that I’m requesting the right key and the path is working properly.

		set the_main_bundle to call method "mainBundle" of class "NSBundle"
		
		set app_name to call method "objectForInfoDictionaryKey:" of the_main_bundle with parameters {"CFBundleName"}
		set app_version to call method "objectForInfoDictionaryKey:" of the_main_bundle with parameters {"CFBundleShortVersionString"}
		set app_copyright to call method "objectForInfoDictionaryKey:" of the_main_bundle with parameters {"NSHumanReadableCopyright"}

Sorry, yes, the method I posted above, I forgot, was referencing something else (numb brain from lack of sleep). anaxamander’s solution is much better anyway.

Jon