From: walkerj@milo.math.scarolina.edu (Jim Walker) Subject: Replace-Existing Hacks 1.3 To: macgifts@mac.archive.umich.edu (Mac archives) Date: Tue, 31 Aug 93 0:29:20 EDT When you try to save a file over an existing file, you get a dialog asking "Replace Existing ?" If you wish to get rid of that dialog, or at least change the default button, this TeachText document (in setext format) tells several ways to do it with ResEdit. There are separate instructions for System 6, System 7.0, and System 7.1. The previous version had a bug: command-period pushed the wrong button. This version is also simpler. -- Jim Walker Ê - REPLACE-EXISTING_ HACKS_ ~by James W. Walker~ CIS: 76367,2271 AOL: JWWalker **Version 1.3, August 1993** If you have ever been annoyed at having to reach for the mouse to respond to the ÒReplace existing fubar?Ó dialog, here are some ways to fix it with ResEdit. Before giving the recipes, I should mention that responsible experts always say that you should only use ResEdit on a ~copy~ of your System file, not the one that is in use. DonÕt say you werenÕt warned. System 6 -------- Open the ALRT -3996 resource in the System. Select ÒSet 'ALRT' Stage InfoÉÓ from the menu. In the resulting dialog box, change the radio buttons to indicate that Cancel, rather than OK, is the default button at each stage. System 7.0, 7.0.1 ----------------- For our first hack, we have a way to make Replace rather than Cancel be the default button. Edit the PACK 3 resource. ResEdit will warn you that this resource is compressed and editing it will decompress it, but never mind that. Normally you will get the hex editor, but if you happen to have the CODE editor installed in your copy of ResEdit, you may have to open the hex editor manually. Anyway, find offset 202C, and change 670A to 670C. (If what you see at offset 202C is not 670A, all bets are off.) Close the System and save changes. Second, there is a hack by Elizabeth Wylie that leaves the buttons alone, but lets you Save with the option key pressed and replace the existing file without even seeing the dialog. Open the PACK 3 resource with the hex editor. At offset 9EC, change 6100 16B0 to 6100 2B2A. At the end of the resource, append: 1038 017B 0800 0002 6700 0006 7001 4E75 6100 EB74 4E75 Close and save changes. Finally, you could use both hacks. System 7.1 ---------- The idea is the same as for 7.0, but the addresses change. For the default button hack, at the address 2104 change 670A to 670C. For the option key hack, at address A36 change 6100 173E to 6100 2BDE, and append 1038 017B 0800 0002 6700 0006 7001 4E75 6100 EB4E 4E75. What Was Wrong With Previous Versions ------------------------------------- The way the replace warning normally works is that the cancel button is the default button, so both command-period and return press the cancel button. Previous versions of my hack essentially switched the buttons. Then the return key activates the replace button, ~but so does command-period~. That could have unfortunate consequences. ThereÕs also the fact that the older versions required changing a DITL resource, while this version changes only PACK 3. Technical Information --------------------- For programmers, hereÕs the disassembly of the PACK 3 hacks. The default button hack replaces BEQ.S *+$000C with BEQ.S *+$000E This skips an instruction that sets the cancel button as the default. The second hack replaces BSR Anon89 + $10 with BSR Anon149 and appends Anon149 move.B $017B, D0 ; Get the byte at KeyMap + 7. btst #$02, D0 ; Is the option key down? beq Anon150 ; If not, do usual stuff moveQ #$01, D0 ; If so, skip the dialog. RTS Anon150 bsr Anon89 + $10 RTS