Re: XML handling
Re: XML handling
- Subject: Re: XML handling
- From: Christopher Nebel <email@hidden>
- Date: Thu, 19 Nov 2009 11:46:12 -0800
On Nov 18, 2009, at 3:47 PM, Christopher Stone wrote: On Nov 17, 2009, at 18:20, Joshua Whalen wrote: ______________________________________________________________________
Hey Folks,
I'll second Joshua on this.
For some time now I've been using the Finder to get the short version string of applications for a script I use regularly. Unfortunately the Finder and System Events don't always produce the string that can be seen readily in the Finder's Get-Info dialog.
Parsing the application bundle's Info.plist for the value of CFBundleShortVersionString seems like the more reliable way to go and using information from the recently posted link to Ben Waldie's article at MacTech let me do this neatly with System Events.
tell application "System Events" tell property list file fPath tell contents set shortVersionString to value of property list item "CFBundleShortVersionString" end tell end tell end tell
Serendipity. :)
Two things to point out here:
One, plists are not necessarily XML. Christopher gets it right here by using "property list file", but I like to remind people.
Two, AppleScript supports this particular case directly these days. As of Leopard, you can say "version of application ..." (and using a path for the name works too), and it'll give it to you without launching the application. In fact, it gets the CFBundleShortVersionString.
--Chris Nebel AppleScript Engineering |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden