I’m wanting to create a list with all the names and version numbers of applications in the Applications Folder (Mac OS). Is there an easy way to read the version numbers for each application? The number I’m after is the one you see in the Get Info window in the finder.
Do you know where in the App bundle the plist file “info.plist” is located? This file contains the information you need. You can try to parse it directly.
The MBS plugins have a simple method for this:
if theFilemakerFolderitem = nil then Return 0
dim theCFUrl as CFURLMBS = NewCFURLMBSFile(ApplicationFolderitem)
if theCFUrl = nil then Return 0
dim theCFBundle as CFBundleMBS = CreateBundleMBS(theCFUrl)
dim theCFDictionary as CFDictionaryMBS = theCFBundle.GetInfoDictionary
if theCFDictionary = nil then Return 0
dim theVersion as String = st(theCFBundle.GetValueForInfoDictionaryKey(theCFBundle.kCFBundleVersionKey))
Return val(NthField(theVersion, “.”, 1))
I’m pretty sure that Macoslib has something similar.
You can use AppleScript - Example
If you want to scan the subfolders of Applications remove the comment on
in lb.Open Event
Asking about Mac OS, not Mac OS X, I assume?
On Mac OS X, the “Willious” way is the one I use as well.
Thank you all for your answers. I’ll try both options and see how I go.