Re: How to reliably get an application's creator type on MacOS X
Re: How to reliably get an application's creator type on MacOS X
- Subject: Re: How to reliably get an application's creator type on MacOS X
- From: Chris Nebel <email@hidden>
- Date: Sat, 14 Apr 2001 19:50:28 -0700
- Organization: Apple Computer, Inc.
Mark Alldritt wrote:
>
As far as I can tell, the "info for" command in StandardAdditions and the
>
Finder's creator type property cannot be used to determine the creator type
>
(i.e. Signature) of a bundled application on MacOS X (e.g. Mail.app).
>
>
Here's some code that uses my XML Tools scripting addition to reliably get
>
the creator type of an application: ...
Mark is correct that "info for" as of AppleScript 1.6 doesn't know about
packages, and just treats them as folders. (We have a bug against this.) In
the meantime, though, there's an easier way to get the creator code than Mark's
XML solution. All packaged applications are supposed to contain a "PkgInfo"
file inside the "Contents" folder -- it's eight bytes long, and contains the
type and creator mashed together (e.g. "APPLToyS"). Therefore, to get the
creator, you can do something like this:
to getCreatorCode(app)
try
return file creator of (info for theAppFile)
on error
return (read file (app as string & "Contents:PkgInfo") from 5)
end
end
--Chris Nebel
AppleScript Engineering