File types and Creator Codes Part One
Written and published February 23, 2000
This week's column is a bit of a departure. Instead of showing you how to do something, we will be discussing "creator codes" and "file types." Understanding it leads to efficiency; it'll (a) help you with using CMTools' change feature, mentioned last week, and (b) help you in the future. The future? Well, whenever you come across these terms. Or when Bill Briggs and I release an AppleScript utility he's developed to share with all of us. Of course, it happens to be for changing file types and creator codes. And, of course, we'll show you how to use it efficiently.
Every file on your Mac has two codes that go along with it. (The codes are part of the information about the file that is stored in the directory structure of the file system, along with the settings for flags like "shared", "name locked", visibility", etc.) These codes are its identity. One tells a Mac which application the file belongs, while the other tells the Mac what kind of a file it is (for example, text, PICT image, Word binary, font, or any of thousands of other possible types).
Author's note: Actually, it would be nicer if Apple would call "file types" "file codes" instead. After all, the four-letter thing that makes the identification is a "code." But alas, we're stuck with their terminology. At least for purposes of explaining it here.
Way back in one of my first columns I pointed out that no matter where you store a file on your hard drive, if the application that made it is on your hard drive, the Mac will find and launch that application automatically when you double-click the file. This is able to happen because of one of the codes stored in the hard disk's directory structure as part of the file information for each file on your Mac.
Apple's Developer Connection Glossary calls the creator code an application signature and says this about it: "A unique four-character identifier that allows the Finder to distinguish a given application from other applications. Sometimes called the creator code."
When developers create a new application, they register its application creator code with Apple to ensure the creator code for each application is unique.
Besides knowing what application a file "belongs" to, the file needs to know what type of file it is. Is your AppleWorks document word processing, drawing, spreadsheet or paint document? Is your Word file a standard Word file or RTF? Is your Photoshop file plain vanilla Photoshop or a tiff, GIF or JPEG? The File Type is another four-character code that denotes what sort of file it is.
Sometimes a file type is unique to the application that created the document. For example, Quicken's data file (which holds your financial information) is (probably) unique to Quicken. TypeIt4Me also has a unique file type (T4ME).
In other cases the "type" of the file is one handled by many different applications and can thus be opened by any capable application on your Mac. In this case, you can even use the creator code to assign a new owner to the file without having to open it and save it from the other application. An example of this would be a GIF or JPEG. Any image editor or viewer will open these files, so you can change the creator code (the owner) of the file to an application of your choice.
The Mac uses the file type another way too. When you double-click a document, but you don't have the application that created it, the Mac looks at the file type, then seeks out another application that may be capable of opening this file type. (Of course, you may not have such an application installed.) You can help this process along within the File Translation tab of the File Exchange Control Panel (PC Exchange in OS7 and OS8), but that's another story or column.
Next week we'll bring you part two of this information, discussing why or how this stuff important to you, then showing you how to discover the codes of the programs and files you use.