• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: XML handling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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:
http://www.mactech.com/articles/mactech/Vol.22/22.03/StoringandAccessingData/index.html

I'm glad this thread got started. I'd been meaning to do this research forever.
______________________________________________________________________

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

References: 
 >re: XML handling (From: Joshua Whalen <email@hidden>)
 >Re: XML handling (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: Basic Script Blues
  • Next by Date: Re: More date/time stuff
  • Previous by thread: Re: XML handling
  • Next by thread: Apple Script For Opening External EML File With Apple Mail
  • Index(es):
    • Date
    • Thread