• 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: application file id?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: application file id?


  • Subject: Re: application file id?
  • From: Christopher Nebel <email@hidden>
  • Date: Mon, 5 May 2003 18:05:33 -0700

On Monday, May 5, 2003, at 04:35 PM, John Delacour wrote:

At 10:22 am -0700 5/5/03, Christopher Nebel wrote:

That's good to know! I must have overlooked it in release notes. I noticed that 'info for' does not return the bundle identifier. is there some way to discover the identifier via script?

Not as such, no, but you could fake it with "do shell script":

set a to choose application as alias
do shell script "grep -A1 CFBundleIdentifier " & quoted form of POSIX path of a & "/Contents/Info.plist"

The last line will contain the bundle identifier. Getting *exactly* the bundle identifier is left as an exercise for the reader.

do shell script "
defaults read /Applications/TextEdit.app/Contents/Info CFBundleIdentifier"
--> "com.apple.TextEdit"

do shell script "
defaults read /Applications/TextEdit.app/Contents/Info CFBundleSignature"
--> "ttxt"

I had no idea you could point defaults(1) at an arbitrary plist file. (Interestingly, you have to use a full path minus the extension.) Combining the two...

set a to choose application as alias
do shell script "defaults read " & quoted form of POSIX path of a & "/Contents/Info CFBundleIdentifier"

Far superior -- it gets exactly the information you want, and isn't vulnerable to different formats of plists. Thanks, JD!


--Chris Nebel
Apple Development Tools
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: application file id?
      • From: Chris Page <email@hidden>
References: 
 >Re: application file id? (From: John Delacour <email@hidden>)

  • Prev by Date: Re: application file id?
  • Next by Date: filemaker 6 unexpectedly quits -- dismiss dialog
  • Previous by thread: Re: application file id?
  • Next by thread: Re: application file id?
  • Index(es):
    • Date
    • Thread