• 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: Getting an app's identifier
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting an app's identifier


  • Subject: Re: Getting an app's identifier
  • From: John Stewart <email@hidden>
  • Date: Fri, 30 May 2003 16:47:52 -0400

On Friday, May 30, 2003, at 10:48 AM, Rob Jorgensen wrote:

And this works on your box?
With what OSAXen coercions active?
Choose app returns an application name not a path. And the rest of the code blows up with choose file.

Hmmm looks good though : )

On Friday, May 30, 2003, at 04:31 AM, John Stewart wrote:

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

return bID

There is a second form of this which returns the plist info, I'll leave it to you to figure out how to parse it.

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

Just an FYI to anyone messing with the scripts submitted on this thread...

I later ran my script on the FileMaker Pro 6 app and discovered that the target plist is named Info-macos.plist instead of the more generally used info.plist. Of course, this causes the script to fail. I suspect that the name of the file, and the location, is at the discretion of the app's developer. As always, error checking should be applied in cases where you aren't sure of the file's existence, name and/or location. :-)

-- Rob

Change this -> set a to choose application
to this -> set a to choose application as alias
in both scripts

To answer Paul's question, yes they worked on the limited number of applications I tested with. I might have used Choose File instead but I'm not too sure of the outcome of that. OS X "files" may be packages (special folders) and what you get may not be what is expected, i.e. I haven't tested it either.

In answer to Rob's comment, if you are going to quote someone, please include all of the relevant text. I specified in my email that error checking needed to be added. That would have accounted for cases such as the one you mentioned or at least done a better job.

If anyone comes up with better ways, I'd love to hear them.

John
_______________________________________________
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: Getting an app's identifier
      • From: Rob Jorgensen <email@hidden>
References: 
 >Re: Getting an app's identifier (From: Rob Jorgensen <email@hidden>)

  • Prev by Date: Re: Faster List Checking
  • Next by Date: Re: Faster List Checking
  • Previous by thread: Re: Getting an app's identifier
  • Next by thread: Re: Getting an app's identifier
  • Index(es):
    • Date
    • Thread