• 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
How to reliably get an application's creator type on MacOS X
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to reliably get an application's creator type on MacOS X


  • Subject: How to reliably get an application's creator type on MacOS X
  • From: Mark Alldritt <email@hidden>
  • Date: Wed, 11 Apr 2001 09:46:45 -0700

Hi Folks,

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:

on getCreatorType(theAppFile)

try
return file creator of (info for theAppFile)
on error
-- its a bundled applicaton which we cannot seem to get the file
-- type for (both the Finder and info for fail to return creator
-- types for bundled applications). The code below extracts the
-- creator type from the application's "plist" (Property list).
-- This is an XML file that contains all the meta information
-- that lived in the file system under the Classic MacOS.

local creatorType
set creatorType to "????" -- in case the plist does not specify it

tell application "Finder" to set theAppFile to theAppFile as string
set theXML to XML contents of item 1 of XML contents of (parse XML
(read file (theAppFile & "Contents:info.plist")))
repeat with i from 1 to length of theXML
local anElement
set anElement to item i of theXML
if XML tag of anElement is "key" and item 1 of XML contents of
anElement is "CFBundleSignature" then
set creatorType to item 1 of XML contents of item (i + 1) of
theXML
exit repeat
end if
end repeat

return creatorType
end try

end getCreatorType

getCreatorType(choose file)


The XML Tools scripting addition is available from
<http://www.latneightsw.com/freeware/XMLTools2/>.

Cheers
-Mark

---------------------------------------------------------------------
Mark Alldritt Late Night Software Ltd.
Phone: 250-380-1725 333 Moss Street
FAX: 250-383-3204 Victoria, B.C.
WEB: http://www.latenightsw.com/ CANADA V8V-4M9


  • Follow-Ups:
    • Re: How to reliably get an application's creator type on MacOS X
      • From: Chris Nebel <email@hidden>
    • Re: How to reliably get an application's creator type on MacOS X
      • From: Paul Berkowitz <email@hidden>
  • Prev by Date: Re: EOF madness!
  • Next by Date: Re: EOF madness!
  • Previous by thread: Re: X-script header Re: =b4
  • Next by thread: Re: How to reliably get an application's creator type on MacOS X
  • Index(es):
    • Date
    • Thread