close this bookTidBITS#99   
View the documentFun with the Finder
View the documentFinder Command Keys
View the documentThe fmnu Template
View the documentQuit the Finder
View the documentZoom Animation
View the documentFree Size Display
View the documentRename Delay
View the documentApplication Substitution
View the documentFoot Notes

Topics:

Copyright 1991 TidBITS Electronic Publishing. All rights reserved.
Information: <info@tidbits.com> Comments: <editors@tidbits.com>


Fun with the Finder

Virtually every article ever written about ResEdit warns you to always work on a copy and to keep backups and so on. This warning has become somewhat cliche, but we're going to do it anyway: only work on a copy of the file and keep backups. We recommend always using the latest version of ResEdit since Apple does make significant improvements to each new version. As of the publication date, the latest version we've seen is 2.1.1. With all of these procedures for modifying the Finder, you'll have to drag the original out of the System Folder, drag your modified copy into the System Folder, and reboot before any changes will take effect. Finally, ResEdit is not for the timorous. Because of that, we have not taken a hand-holding approach to the directions, so if you have no idea what the directions mean, feel free to experiment, but make sure that you're working on a copy and that you don't throw the original Finder out until you have determined that your copy works fine. 'Nuff said.

We should note that there are several shareware utilities that will do some of this dirty work for you. Check out the System 7 Pack from Adam Stein for application substitution, rename delay editing, and adding command keys to the Finder. FileEdit (soon to be called FinderEdit) can add substitute applications, and the freeware extension UnderStudy can do the same, although UnderStudy requires the use of ResEdit to configure your substitutions. Connectix makes the most powerful utility in this arena, Hand-Off II, which can not only substitute different applications for standard document formats but goes one further by allowing you to substitute (for example) Nisus for all documents that have been created by Word, no matter what type (TEXT, WDBN, etc.) those files may have. Finally, a small application called Anti-Finder can quit the Finder and then launch it again.

In a bit, the tricks, but first a note from Eric, who contributed much of this issue and a bunch of tips on System 7 for a forthcoming issue. "The following are various tricks I've come across. If you have any questions drop me a line. These are my tips, not Apple's!"

Information from:
Eric Apgar -- apgar@apple.com
Robert Hess -- ENDPOINT@applelink.apple.com
Adam C. Engst -- ace@tidbits.halcyon.com
Trey Campbell -- FLC3527@tamxrd.tamu.edu
Russ Arcuri -- raa92@137.238.1.1


Finder Command Keys

If you don't have an fmnu template (see below) and you want to change or add a command key to a menu item, you have to poke around until you find the text of the menu item's name (e.g. "Empty Trash") and then change the byte that is three bytes before the first letter of the item's name to the command key. Maybe an example would help - to use Command-T to "Empty Trash", open fmnu #1255 (ResEdit opens fmnu resources as generic resources unless you have an fmnu template, see below), and change byte number 2C to "T" or $54. Byte number 2C is three bytes before the "E" in "Empty Trash" at byte number 2F. Like most things with ResEdit, this isn't for the faint of heart, and for all I know it may have some disastrous consequences. But it works for me, and I haven't noticed any side effects.


The fmnu Template

The System 7 Finder has been completely rewritten in C++, so none of the old ways to customize the Finder with ResEdit work anymore. There are, however, a couple of things you can do with ResEdit in the new Finder, too. The menus are stored in resources of type fmnu (they include quite a bit more information than would fit in the regular MENU resource type) and here is how you can create a template to edit them. (ADAM: If you're busy like me or lazy, you won't want to do this. Therefore, I'm including a copy of the fmnu template with this issue. Just open it with ResEdit, open the ResEdit Preferences file in the Preferences folder in your System Folder, copy the fmnu resource, and paste it into the ResEdit Preferences file. Close both and enjoy!) Use ResEdit (preferably 2.1.1, but it should work with older versions) to modify the ResEdit Preferences file by adding a new resource of type TMPL. Create 15 new fields in the list and enter the following values for "Label" and "Type":

  Label         Type     Comment
  Visible       DWRD     1=Menu is visible in Menubar; 0=invisible
  Item Count    DWRD     the number of items in the menu plus 1
  ???           DWRD     ???
  Menu Number   DWRD     the resource ID of the fmnu
  ???           DWRD     ???
  ???           DWRD     ???
  Title         ESTR     title of menu (padded to an even length)
  *****         LSTB     begin of item list
  AppleEvent    TNAM     corresponding AppleEvent for this item
  ???           DBYT     ???
  ???           DBYT     ???
  Cmd Key       CHAR     keyboard equivalent of command
  ???           DBYT     ???
  Item Text     ESTR     text of item
  *****         LSTE     end of item list

Please note, that a "???" indicates that I simply don't know what these fields contain (maybe they will one day be documented by Apple). Once you've entered this list, close the TMPL resource you've just created and change its name to fmnu using the Get Resource Info... command. Finally close and save the ResEdit Preferences file. You can now edit the Finder's menus and do other neat things.

While the above technique actually gives you the same freedom of customization that you already had in the System 6 days, you can do a lot more with the new fmnu resources:

For instance, the fmnu resource type is not position-dependent anymore! This means that you can actually completely rearrange the menus in the Finder. All you need to do is make sure that you copy all the information stored in the various fields of an item to its new destination (copy and paste can be a lot of help here!). You can even create your own menu and move commands from other menus to the new one!


Quit the Finder

Sometimes it's nice to quit the Finder. This frees up a little bit of memory (not as much as you would think) but, even better, it lets you edit the Finder or rebuild your desktop without rebooting (you can hold down the Command and Option keys when the Finder restarts and it rebuilds the desktop). Remember: when you quit the Finder you lose the Apple Menu's items and the use of Background Printing. After you quit the Finder, you can start it with a utility that launches other applications (assuming that it's a utility that recognizes the Finder as a program that can be launched) or by quitting all running applications.

Open a copy of your Finder in ResEdit and open the fmnu resources.

Each one of the fmnu resources is a Finder menu. Here are the more important menus:

  1251: Apple
  1252: File
  1253: Edit
  1254: View
  1255: Special
  1256: Label
  90125: Chez Oui (just kidding)

(The others are, for the most part, menus that appear elsewhere in the Finder, like in the "Find" dialog box.)

Assuming that you want to add "Quit" to the Special menu (though this works for adding "Quit" to any menu), open fmnu #1255. If all you see is a bunch of hexadecimal code, you need to install the fmnu template we just discussed. Stop here until you get the fmnu template installed. If you see:

  Visible
  Item Count
  ???

etc., then you're ready to go. (Good hacker. <pat pat>) Now scroll down to the bottom of the dialog box. You should see:

  9) *****

Click on the "*****". A box should appear around it. Go to the "Resource" menu and select "Insert New Field(s)". A new, blank set of fields should appear below the "9) *****" followed by a new "10) *****". Fill in the fields above the "10) *****" like this: (Those are zeros, not the letter "o" below.)

  AppleEvent     xxx0
  ???            0
  ???            0
  Cmd Key        (leave this one blank)
  ???            0
  Item Text      - (a minus sign)

That will create a divider bar. Now click on the "10) *****" and select Insert New Resource(s) again. Now you have a "11) *****". Fill in #11 like this:

  AppleEvent     quit (EXACTLY 'quit' - lowercase is important)
  ???            -127
  ???            0
  Cmd Key        Q (you may leave this blank; see below)
  ???            0
  Item Text      Quit

You may leave the "Cmd Key" section blank. This is (surprise) what command key you want this menu item to have. I like Command-Q for "Quit". Some people find this inconvenient since it's easy to accidentally quit the Finder if you have such a key. That's up to you; quitting the Finder is no big deal since it may easily be launched again (by quitting all running applications or by launching it with a utility such as PowerStrip, as I mentioned above).

Now go up to the top of the window and make sure that the field that says "Item Count" has "11" next to it. If it doesn't, change it.

Quit ResEdit, saving your changes. You're done!

Using this technique, you may rearrange menus anyway you like. You could, for example, move the "Find" commands to the "Edit" menu simply by moving their 2 items from one fmnu to another. The System 7 Finder doesn't care where things are. You could, in fact, remove all menus from the Finder except the Apple but that would be stupid.


Zoom Animation

When the Finder opens or closes an item, it shows an animation effect usually called the "ZoomRect" (zooming rectangles describes it pretty well, so that's what those innovative programmers called the procedure). When you open or close a lot of items, especially on a slow Mac, this effect is suddenly renamed "damnSlowZoomRect". Here's how to remove the effect:

  1. Open a copy of the Finder with ResEdit 2.1.1
  2. Open the Code resource
  3. Open Code ID 4 (Yup, you need to decompress it)
  4. Find hex 4E56 FFE0 48E7 1F38
  5. Select these bytes
  6. Replace with 205F 700A DEC0 4ED0
  7. Save the copy of the Finder and close ResEdit.

Free Size Display

When the amount of free space in the Finder is more than one megabyte, the Finder displays the free space in megabytes. I like it to keep displaying in K. This will force the Finder to display always in "K", not "M".

Launch ResEdit and open your copy of the Finder. Open the CODE resources. Click once on resource number 23. Go to the "Resource" menu and select "Open Using Hex Editor..." (don't double-click on it since you might have a fancy CODE template installed in your ResEdit, which would make the next step possibly impossible [don't tell my old English teacher that I said that]). Click Yes if it asks if you want to decompress the resource.

Use "Find Offset..." to go to offset 18E. You should see

     0C86 0010 0000 6500 0082.

If you don't, don't continue.

Change the 6500 to 6000. That is, change:

     0C86 0010 0000 6500 0082

to:

     0C86 0010 0000 6000 0082

Quit ResEdit, saving your changes. All this patch does is change a conditional branch to an unconditional one. In other words, whereas the Finder used to say, "If the amount of space available is more than one meg, display in M; otherwise, display in K," it now says, "If the amount of space available is more than one meg, uhm, display in K." Trust me; it really says that. Listen closely next time.


Rename Delay

The rename delay is tied to the setting for double-click speed in the Mouse Control Panel. The slower the double-click speed, the longer you wait for the Finder to enter edit mode after you click on a file name. However, if you hit the Return or Enter key after clicking on a name, you enter edit mode immediately (this is included for those who don't want to change their Finder). If you do, read on.

Use ResEdit to open CODE resource 11. At offset A28, you will find the value E388. You can substitute the following values to reduce the delay time:

  1/2 normal delay, use 4E71
  1/4 normal delay, use E288
  1/8 normal delay, use E488.

Having changed the value here, you are still tied to the double-click speed. Other values are possible, but a better alternative may be to eliminate the delay completely. You can do this by going to offset A5A, where you will find the value 5DC0, and replacing it with 50C0. I've been using the latter patch myself for several weeks now without any apparent side effects.


Application Substitution

One of the new features in Finder 7 is that it can substitute one application for another, assuming the second application can open the first one's documents. This is why the Finder will try to open TEXT files and PICT files in TeachText if it can't find the original application. You can add your own substitutions (ADAM: I personally have all TEXT files, Word files, and MacWrite files open in Nisus, which is much handier than keeping copies of everything else around.).

First, make a copy of the Finder, as ResEdit won't allow you to work on the currently active Finder. Launch ResEdit and open the copied Finder. Next double-click on the fmap resource. Now open resource # 17010. You will see a window with hexadecimal code on the left and garbled text on the right. The text on the right should read:

     TEXTttxt
     PICTttxt
     00000000

The last line is actually a line of rectangles, not zeros. Select the entire line of rectangles, and choose Copy from the Edit menu. Then, without deselecting the line of rectangles, choose Paste from the Edit menu. Nothing much should happen. Now choose Paste again, and you should end up with a second line of rectangles under the first, so that the whole thing looks like this:

     TEXTttxt
     PICTttxt
     00000000
     00000000

Now, select the entire first line of rectangles, and type in the document type and creator that you want that document opened with. For example, if you want all MacWrite documents to be opened by Microsoft Word, you would type "WORDMSWD" so that when you are done, the text looks like this:

     TEXTttxt
     PICTttxt
     WORDMSWD
     00000000

Now close the fmap #17010 window, the fmap window, and the Finder window.

Click Yes when ResEdit asks you if you want to save changes. Quit ResEdit, move the currently active Finder out of the System Folder, and rename the "Finder copy" to "Finder." Reboot the machine, and from now on when you double click on a MacWrite document, the Finder will ask you if you would like to open it with Microsoft Word. Other combinations can be added to the Finder using the same method of replacing those eight rectangles (non-printing characters) with the four character type of the document and then the four character creator of the application you wish to use instead of the original one.


Non-profit, non-commercial publications and Web sites may reprint or link to articles if full credit is given. Others please contact us. We do not guarantee accuracy of articles. Caveat lector. Publication, product, and company names may be registered trademarks of their companies. TidBITS ISSN 1090-7017.