bradandkathy.com

Toward a More Friendly Finder

Adding application substitutions to the System 7 Finder

Note: This article originally appeared in the newsletter of the Southern Maine Apple Users Group (SMAUG), circa 1991. It has been modified slightly from the original version, but no effort has been made to update information that has become out-of-date since the original publication. It is presented here as an historical curiosity of a bygone era.

The System 7 Finder has some pretty nifty features that I wonder how I managed to get along without. One is its occasional politeness. Instead of curtly refusing to open a TEXT document created with a program you don’t have, it gives you the option of opening the document with TeachText. Same goes for PICT documents (see Figure 1). But it only goes so far. If you double-click on, say, a Microsoft Word document and your only word processor is MacWrite II (a situation I run into all too often), it still leaves you in the lurch. Doesn’t it seem like such a friendly finder ought to be able to help you out there, too? After all, MacWrite II can read Word files, right?

Figure 1: The System 7 Finder being friendly

Well, here’s the solution! It turns out the System 7 Finder is set up to allow much more “application substitution” than it lets on. With a copy of ResEdit and a modicum of intelligence, anyone can add his or her own substitutions or change the default ones (like opening orphaned TEXT documents in MacWrite or Word instead of TeachText). But there is a catch: you can’t make a document open in an application that doesn’t support its format. (You can’t open an Excel document in TeachText, for example.) So long as the application supports the format, you should have no problem.

This article will show you how to add your own substitute applications. It is important to remember that the substitutes come into play only if the original application is not present. If you add MacWrite II as a substitute for Word files, and later decide to send some money Bill Gates’ way by buying Word, you won’t have any problem opening Word documents in Word.

You will need a copy of ResEdit (the latest version is 2.1.1) and some familiarity with how to use it. If you don’t feel comfortable enough with ResEdit to muck around the Finder, I’d suggest you take a look at the ResEdit Primer available online or pick up one of the excellent ResEdit books available, such as Zen and the Art of Resource Editing, ResEdit 2.1 Complete (my favorite, by Peter Alley and Caroline Strange), or Apple’s own ResEdit Reference. Even if you aren’t very familiar with ResEdit, you can probably manage this little hack without much difficulty. If you’re still scared of screwing something up beyond repair, try to find a copy of Adam Stein’s shareware program “Document-Application Linker!,” which does the same thing, but will cost you $10.

You will also need to understand a bit about file types and creator codes. These are four-letter codes used by the Finder to keep track of which documents belong to which applications and whether a file is a document or an application. You will at least need to know the creator code for the application you want to use as a substitute, and the file type of the file you want the application to open. A list of many of these codes can be found at the end of this article. Note that the codes are case-sensitive, so “TEXT” is not the same as “text.” If you’re not sure of a type or creator code you’ll need, you can find out by using ResEdit’s “Get file/folder info…” option under the File menu or by using a utility such as DiskTop or FileTyper.

To get started, open your system folder and click on the Finder. Make a copy of the Finder by selecting “Duplicate” from the file menu, or by pressing command-D. The copy will be created next to the original and will be named, oddly enough, “Finder Copy.” As with any ResEdit project, be sure to work only on a copy of the file. (ResEdit 2.1 won’t let you edit the active Finder, anyway, but a ResEdit article wouldn’t be complete without that warning.) Launch ResEdit and open the copy of the Finder you’ve just created.

ResEdit will present you with a window displaying an icon for each resource type in the file:

Figure 2: The resources in the Finder

We’re interested in an “fmap” resource, so double click the “fmap” icon or click on the icon and select “open fmap picker” from the Resource menu. You should now see a window containing a list of all of the “fmap” resources in the file (see Figure 3).

Figure 3: fmaps in the Finder

The substitute application information is stored in fmap ID 17010. But WAIT! Don’t double click on it yet! If you double-click on the fmap resource, you’ll end up in a resource template that does little more than confuse things. (If you really want to, go ahead and try it. Once you’ve taken a look, close the template by clicking in its close box.) Instead, click on the resource and open it using the hex editor by selecting (strangely enough) “Open using Hex editor” from the Resource menu.

The hex editor window should look like this:

Figure 4: fmap 17010, the secret to this whole thing!

The resource information is shown in both hexadecimal and ASCII. If you’re a hex junkie, you can work with the hex representation; otherwise, just pay attention to the ASCII portion on the right. Each row of eight characters contains one substitution. The first four characters are the file type of the orphaned document and the second four are the creator code for the substitute application. The two default substitutions use TeachText (ttxt) for orphaned TEXT and PICT documents.First, let’s change the TEXT substitute from TeachText to MacWrite II. Remember: TeachText documents will still open in TeachText. All we’re changing is the “pinch hitter” application for orphaned TEXT documents. First select the characters “ttxt” as shown in Figure 4. The hex editor will automatically select the corresponding hex representation. Now type the creator code for MacWrite II, “MWII.” If you’d prefer, you could type “MSWD” for Microsoft Word, or the creator code for any other application able to open TEXT documents.

To a new substitute application, position the insertion point at the beginning of the line of boxes “▯” and type the four-letter document type followed immediately by the four-letter creator code. Do not enter a return! After entering a couple of new substitutions, the window should look something like this:

Figure 5: New and Improved fmap 17010!

Do not change the series of little boxes! It is important that your fmap ends with a complete line of eight of the little buggers.

When you’re done adding and changing the fmap, click in the close box to close it. Close the list of fmaps the same way, save your changes with the “Save” command in the File menu, and quit ResEdit.

The next part can sometimes be tricky and may require starting up from a floppy. Drag the active Finder out of your system folder (but don’t trash it!), rename “Finder Copy” to “Finder” and restart. If all has gone well, you should now have a new, even friendlier Finder. Try double-clicking an orphaned document for which you’ve set up a substitute application. You ought to get a dialog box like the one in Figure 1 giving you the option of opening it in the substitute application. Way Cool! If something has gone awry, try restoring the original Finder and double-checking your modifications with ResEdit. Good Luck.

Have Fun! Although I’m sure there is some limit on the number of substitutes you can have, I haven’t run into it yet.

File Types and Creator Codes

File Types Creator Codes
TEXT Plain text file MACS System software
PICT Picture File ttxt TeachText
ttro TeachText read-only text file MSWD Microsoft Word
MSWD MacWrite document XCEL Microsoft Excel
MW2D MacWrite MPRO MacWrite Pro
WORD MacWrite document MACA MacWrite
MW2D MacWrite II document MWII MacWrite II
WDBN Microsoft Word document FWRT FullWrite Pro
AWWP Microsoft Works wp document SSIW WordPerfect
DRWG MacDraw II document
PNTG MacPaint document
drwC WordPerfect document
WPPC WordPerfect PC document
DRWG MacDraw II document
PNTG MacPaint document
drw2 Canvas document
TPDN Topdown document
SPTG SuperPaint document
FHD3 Aldus Freehand 3.0 document
PRS1 Aldus Persuasion 1.0 document
PRS2 Aldus Persuasion 2.0 document
CGTX Cricket Graph data document
CGPC Cricket Graph document
LWFN PostScript font
ALB3 Aldus Pagemaker 3.0 document
ALT4 Aldus Pagemaker 4.0 document