Hacking FinderHack: CMD-DEL for System 7.1

JDW

Administrator
Staff member
Founder
Sep 2, 2021
1,577
1,373
113
53
Japan
youtube.com
10/23/2024 UPDATE:
@phipli ultimately provided the final solution: Use a scriptable Finder version 7.1.2, 7.1.3 or 7.1.4, install AppleScript 1.1, write the appropriate script, save as Application, then use Easy Keys to Assign the CMD-DEL keystroke. Perfect for System 7.1! (Start reading this post for details.)



Last night, I mentioned the need to hack FinderHack in my FaceBook post here in order to change its CMD-T keyboard shortcut the more commonly known and widely used CMD-DEL. The reason to use FinderHack is to bring the file-delete keyboard shortcut to System 7.1.

1712971548245.png


Matt Sephton (aka Gingerbeardman) chimed in with "CMD-DEL" hack that you can now download from the Garden, which is fantastic! The only thing left to do is to eliminate the bothersome confirmation dialog that appears when you select a file and then press CMD-DEL.

The author of FinderHack is Donald M. Brown, which interestingly enough was a programmer and founding partner of CE Software's QuicKeys. Who better, I thought, to eliminate that confirmation dialog box than the creator of FinderHack. I Googled like mad and found the following links to Donald:
  1. Personal web page (with an old email address) — seems to have gone down in the last couple years.
  2. Blog site
  3. Linkedin (only Premium members can contact him)
  4. Twitter (not sure how to initiate contact these days)
  5. AppleInsider Forums (I sent him a message)
  6. YouTube (sadly, he never enabled his email address via Business Contacts)
I sent an email to the address mentioned on Don's personal web page, but it came back saying his inbox was full. That warning sign, combined with the fact his Blog site went down sometime after Feb. 2023 indicates he may have passed away only a year or two ago. Just like Paul C. Pratt, we have another valued member of the community who has possibly gone missing.

REQUEST FOR HELP: If any of you have ideas on how to HACK old Mac software, maybe you could chime in with a proposal about how to eliminate the confirmation dialog that appears after pressing CMD-DEL

Thanks!
 
Last edited:

JDW

Administrator
Staff member
Founder
Sep 2, 2021
1,577
1,373
113
53
Japan
youtube.com
Hmmm, that blows.
Indeed. It blows like a thread with few replies! (I get antsy when few people reply to important threads.)

Thankfully, I am having an ongoing conversation with Gingerbeardman over on FaceBook, and he is proposing some solutions via KeyQuencer. We haven't gotten there yet, but if the work does work out, then I can post it here for all to read.

I actually much prefer this forum over FaceBook groups. You can post lots of test and inline pics here, whereas FaceBook doesn't lend itself to that. Even so, you've gotta go where the replies are, and that's what I do out of sheer desperation often times.
 
  • Like
Reactions: Volvo242GT

Opualuan

New Tinkerer
Oct 10, 2024
13
5
3
I was able to make this work with a script in quickeys (slow) and keyquencer before I found Hidden Finder Features (but I use 7.5.5). I can look to see if my keyquencer script is still around, I don’t think it was too complex.
 
Last edited:

phipli

Tinkerer
Sep 23, 2021
118
117
43
If you only need it in 7.1 and later, you could do this with AppleScript, Finder 7.1.3 or 7.1.4 from System 7 Pro or System 7.1.2 (edited out an error where I said Finder 7.1.2 instead of the Finder versions from System 7.1.2) and... that thing that adds applications to the F-keys.

Finder 7.1.2 is a basically silent upgrade that adds compatibility with a few things like scriptable finder to System 7.1.

This is all that is needed once you have Finder 7.1.2 and AppleScript installed :

1729499822503.png


Save as an application and attach to a key combination. https://macintoshgarden.org/apps/easy-keys looks nice? I've not used it before.
 
Last edited:
  • Like
Reactions: JDW

phipli

Tinkerer
Sep 23, 2021
118
117
43
A couple of quality of life updates to stop you accidentally deleting the script itself, and handling nothing being selected.

This is still an extremely dangerous script because as requested, it doesn't do any confirmation before emptying the trash. I'd not actually run it like this myself and would comment out (place -- before the line) the "empty trash" line.

1729504284891.png


Edit - updated script screenshot for System 7 compatibility (counting selection doesn't seem to work for some reason, at least not how it did in Mac OS 8)

Edit Edit - changed "is" to "contains" so that you can't try to delete the script itself by selecting something else at the same time.
 
Last edited:
  • Love
Reactions: JDW

phipli

Tinkerer
Sep 23, 2021
118
117
43
Here is a demo of it in use on System 7.5.x (I don't have System 7.1 installed on my emulator, but it should work find as long as you have applescript and Finder 7.1.3 / 7.1.4 from System 7.1.2 (Edited out an error where I said Finder 7.1.2, instead of the Finder from 7.1.2).

The low framerate is missing most of the times I press delete sorry, but I am pressing it.

AppleScriptDelete.gif
 
Last edited:
  • Like
Reactions: JDW

JDW

Administrator
Staff member
Founder
Sep 2, 2021
1,577
1,373
113
53
Japan
youtube.com
I tried typing in your script manually (since the text of your script was not available). I merely left out "empty trash" because I don't need that. CMD-DEL in S7.5.5 works by merely casting your selection into the Trash without emptying the Trash.

Unfortunately, it won't compile and complains as follows:

1729580652638.png


I installed System 7.1 Pro exactly as I describe here:

After that, I installed AppleScript 1.0, which installs Script Editor 1.0.1.
Finder version is 7.1.4.

Please advise where I went wrong.
Thanks.
 

phipli

Tinkerer
Sep 23, 2021
118
117
43
Unfortunately, it won't compile and complains as follows:
Please advise where I went wrong.

That error looks like you don't have the normal scripting additions installed - they go in a folder in extensions.

After that, I installed AppleScript 1.0, which installs Script Editor 1.0.1.
Yeah, I wouldn't install 1.0 or anything if newer versions exist. I'd go for a bit newer than that. I'd install version 1.1 which is what I'm using. It should include the Scripting Additions folder in extensions, which will have a file called "Display Dialog" in it. Then that line will work.
1729584776083.png

Finder version is 7.1.4.
That's fine :) 7.1.3 or later is good.
To be clear, System 7.1.2 isn't System 7.1 Pro - 7.1 Pro is System 7.1.1. But, 7.1.2, what you've installed, I prefer because it doesn't install a load of extras that I don't use. I either use System 7.1.0 with Finder 7.1.3/7.1.4, or I just install the 7.1.2 update like you have.
 
  • Like
Reactions: JDW

JDW

Administrator
Staff member
Founder
Sep 2, 2021
1,577
1,373
113
53
Japan
youtube.com
@phipli
Thank you.
Sadly, there's still trouble.

I installed AppleScript 1.1 using these disk images. During the install, it told me that it would install an older version of the Finder. Not sure why AppleScript should even be replacing the Finder, but it did. It installed 7.1.3, overwriting 7.1.4.

These are all the files it installed:

1729586341504.png


Sadly, it still complains in the same way when I click the Check Syntax button:

1729586380693.png


You can download my *.dsk containing the System 7.1.2 install and AppleScript 1.1 here:


I boot that image using the Mini vMac MacII version.
 

phipli

Tinkerer
Sep 23, 2021
118
117
43
It installed 7.1.3, overwriting 7.1.4.
Weird, but probably fine. I think it has decided you need at least 7.1.3, but doesn't realise that 7.1.4 meets the criteria.
These are all the files it installed:
Hummmmm

That isn't the usual AppleScript installer.

What about in the Extensions folder, did it install "Scripting Additions"?
 

JDW

Administrator
Staff member
Founder
Sep 2, 2021
1,577
1,373
113
53
Japan
youtube.com
You spelt "display" incorrectly ;)
Drat! You're right!
1729594124519.png


Please accept my humble thanks for spotting my typo!

All is well now. I can save it as an Application. But further testing will need to wait until tomorrow because my brain is thoroughly fried right now. o_O
 

phipli

Tinkerer
Sep 23, 2021
118
117
43
Drat! You're right!
View attachment 18372

Please accept my humble thanks for spotting my typo!

All is well know. I can save it as an Application. But further testing will need to wait until tomorrow because my brain is thoroughly fried right now. o_O
Ah well, I make more typos than most. Especially when fighting auto correct on my phone.

Its worth checking around an error, before and after, when something like this flags up. Errors in code are notoriously cryptic on a good day, and just... well, wrong, other than the fact that there is an error, in many cases. Common example is that if you forget a line ending semicolon in C, you get an error on the next line that doesn't have anything to do with there not being a semicolon (because C doesn't see white space, it treats it like a weird concatenated line).
 
  • Like
Reactions: JDW

JDW

Administrator
Staff member
Founder
Sep 2, 2021
1,577
1,373
113
53
Japan
youtube.com
@phipli

Easy Keys works well to invoke the Application saved with AppleScript. CMD-DEL throws the selected file(s) in the Trash without emptying the Trash, which is perfect. I've not tested it on a real vintage Mac yet, but it works perfectly in Mini vMac (Mac II version).

By the way, I replaced Finder 7.1.3 (installed by the AppleScript 1.1 installer) with Finder 7.1.4 and rebooted. CMD-DEL still works. So I guess AppleScript isn't installing a modified Finder. It's just installing Finder 7.1.3 because it's "scriptable" and the installer didn't know about Finder 7.1.4 because it's too new so it prompts you to replace it. Interestingly, the filesize (byte size) is exactly the same when you compare those two Finder files. And I spent 20 minutes in ResEdit looking in vain for the differences. Anyway, the short of it is that you can use either Finder version without issue.

Thanks again!



For those of you following this thread who want to copy/paste the script, below is what you need (no typos either):

AppleScript:
tell application "Finder"
    activate
    if (selection is not (empty)) then
        if name of selection contains (name of (info for (path to me))) then
            display dialog "You probably don't want to do that."
        else
            delete selection
        end if
    end if
end tell



UPDATE:
I tested on my Mac SE with WarpSE (25MHz 68000) installed, and it takes about 4-5 seconds before the thing you are deleting gets put into the Trash. So I suspect it would take even longer on the stock 8MHz CPU. Probably less time on an 030 or 040. Also keep in mind that AppleScript and EZ-Keys will eat 209kB of RAM. In other words, your CMD-DEL convenience requires 209kB at all times, even when you aren't using AppleScript or invoking anything with EZ-Keys. On Macs with more than 4MB, this won't matter. But 4MB Macs like the SE are RAM constrained, so it's an important point of consideration, over and above the amount of time required to throw your selected item into the Trash.
 
Last edited:
  • Like
Reactions: Opualuan

phipli

Tinkerer
Sep 23, 2021
118
117
43
By the way, I replaced Finder 7.1.3 (installed by the AppleScript 1.1 installer) with Finder 7.1.4 and rebooted. CMD-DEL still works. So I guess AppleScript isn't installing a modified Finder. It's just installing Finder 7.1.3 because it's "scriptable" and the installer didn't know about Finder 7.1.4 because it's too new so it prompts you to replace it. Interestingly, the filesize (byte size) is exactly the same when you compare those two Finder files. And I spent 20 minutes in ResEdit looking in vain for the differences. Anyway, the short of it is that you can use either Finder version without issue.
Yes sorry, that is what I was saying above, sorry I wasn't clear. You just need Finder 7.1.3 or later - I didn't realise that AppleScript could install it, that is a nice free upgrade. Despite what many applications say in their readme, a lot of software that says it needs System 7.5.0 minimum will actually run on System 7.1 with Finder 7.1.3.

I tested on my Mac SE with WarpSE (25MHz 68000) installed, and it takes about 4-5 seconds before the thing you are deleting gets put into the Trash.
Hum, that is quite slow. I wonder if it is the application launching, or the control panel.
Also keep in mind that AppleScript and EZ-Keys will eat 209kB of RAM. In other words, your CMD-DEL convenience requires 209kB at all times, even when you aren't using AppleScript or invoking anything with EZ-Keys.
Do you know if the bulk of that is EZ-Keys? Or AppleScript. If it is EZ-Keys, alternatives are available. If it is AppleScript, given the functionality it adds is vastly beyond just what is being done here, that is sort of fair enough. Whatever method you do for this is going to involve extra software running in the background watching for key presses if nothing else. It will steal CPU cycles too. Have to admit I just drag things to the bin. I find the lack of Cmd-M, Cmd-D and Cmd-R more frustrating on early versions of System 7.