Important: The information in this document is obsolete and should not be used for new development.
Giving a Signature to Your Application and a Creator and a
The Finder identifies your application through its signature, a unique four-character sequence. The signature must not conflict with the signature of any other application.
File Type to Your Documents
To ensure uniqueness, you must register your application's signature with Apple Computer, Inc., at Macintosh Developer Technical Support.
You must include in your resource file a special resource that has your application's signature as its resource type. By convention, the signature resource has a resource ID number of 0. The signature resource typically contains a string that specifies the name, version number, and release date of your application. If you do not provide specific version information through a version resource (described in "Providing Version Resources" beginning on page 7-29), the Finder displays the string stored in the signature resource when the user selects your application and chooses Get Info from
- Note
- There is no need to register your own resource types because they're usually used in only your own applications or documents.
the File menu.Listing 7-1 illustrates a signature resource in Rez input format. (Rez is the resource compiler provided with Apple's Macintosh Programmer's Workshop [MPW], available from APDA.)
Listing 7-1 Rez input for a signature resource
type 'WAVE' as 'STR '; /*WAVE is the signature*/ resource 'WAVE' (0, purgeable) { /*resource ID is 0*/ "SurfWriter 3.0 © 1992" /*default Get Info string*/ };Whenever your application creates a document, it assigns the document a creator and
- Note
- The signature resource alone is not sufficient to establish your application's signature. You must also supply a bundle resource, described in "Creating a Bundle Resource" beginning on page 7-19.
a file type. Typically, as described in "Using Finder Information in the Catalog File" beginning on page 7-30, your application sets its signature as the document's creator. When a user double-clicks a document or selects it and chooses Open or Print from the Finder's File menu, the Finder reads the creator field of that file to find the document's creator. The Finder then searches for an application with a signature by that name. When it finds that application, the Finder launches it.If the document's creator is your application's signature, for example, the Finder calls the Process Manager to start your application. The Finder then passes to your application the information it needs to open or print the document; since the introduction of
System 7, the Finder has used Apple events to pass this information to your application. Inside Macintosh: Interapplication Communication describes how your application processes the required Apple events to open or print files.As described in "Using Finder Information in the Catalog File" beginning on page 7-30, your application typically assigns a file type to a document when it creates one. The file type can be a type especially defined for your application, or it can be one of the existing general types, such as those listed here.
File type Description 'APPL' Launchable application 'DFIL' File for storing desk accessories 'DRVR' Driver 'FFIL' File for storing fonts 'INIT' System extension 'PICT' QuickDraw picture 'PRER' Printer driver 'RDEV' Chooser extension 'TEXT' Stream of ASCII characters 'adev' Network extension (such as EtherTalk 2.0) 'appe' Background-only application 'cdev' Control panel 'edtp' Edition for sharing graphics-oriented data 'edts' Edition for sharing sound-oriented data 'edtt' Edition for sharing text-oriented data 'ffil' Font 'ifil' Script system resource collection 'kfil' Keyboard layout 'pref' Preferences file 'qery' Query document for database access 'scri' System extension for script systems 'sfil' Sound 'tfil' TrueType font 'ttro' TeachText read-only file 'zsys' A system file (such as the System file itself)
Like signatures, file types must be registered with Apple. Your application must have a file type of
- Note
- Apple reserves the use of all signatures and file types whose names contain only lowercase and nonalphabetic characters. Your signature and the file types created especially for your application must each contain at least one uppercase character. Since the system software
never displays signatures and file types to users, signatures and file types can consist of character combinations that might otherwise be incomprehensible to anyone but you.'APPL'
. The creator field of your application file should contain its own signature. Most programming environments provide a simple tool for setting the creator field of your application file.Your application can create documents of any type, and it can specify any application
as the creator. You could write a utility application, for example, that creates a new
document by opening one text file and appending onto it another text file. The application would give the new document the same creator as the first original text file so
that the Finder can call on that application when the user wants to open or print the
new document.Assign the standard file type
'TEXT'
to files that consist of only text--that is, a stream of characters with return characters at the ends of paragraphs. Most word processors allow the user to create text-only files. A document of file type'TEXT'
can be opened or printed by any application that accepts such file types. Your application can still assign its own signature as the file's creator so that the Finder can call on it to open or print the file when appropriate.Users can also open a document created by your application--as well as a document of a file type supported by your application--by selecting its icon and dragging it to your application's icon. Because the document's file type is stored in the catalog file and the Finder stores a list of your application's supported file types in the desktop database, the Finder can determine whether to launch your application. If the document's file type is supported by your application, the Finder launches your application and passes it the name of the document. (These topics are detailed in subsequent sections of this chapter.)
For example, if your application is a page-layout program, it might create documents of its own file type while also supporting documents of
'TEXT'
and'PICT'
file types. A user can launch your application by dragging a document of any of these file types to your application icon.Your application also relies on file types to determine which files to let the user open when your application is running. When your application calls the Standard File Package to open a file, your application supplies either a list of the file types that your application can open or a filter function for those types. The open file dialog box then displays only files of the specified types. (See Inside Macintosh: Files for details.)