Mac OS 9 Lives! (Classic Mac OS Forum)

Classic Mac Hardware (Troubleshooting, Upgrading, & Modifying) => Mac OS 9 Booting on Previously Unsupported Hardware => Topic started by: alexfree on February 16, 2020, 02:53:12 PM

Title: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: alexfree on February 16, 2020, 02:53:12 PM
For the Mac Mini G4 Hacked ISO v8, the mouse cursor may freeze sometimes right after booting Mac OS 9. Since you canít reboot without the mouse, you would have to force power off the Mac Mini G4. Instead of doing this, which can mess up the Mac OS 9 partition, you can create an Apple Script Application that reboots the Mac. Then set this to a Hot Key Function in Mac OS 9. Now when this happens, you can just press F1 to reboot correctly.

First we will make the Apple Script Application. All it will do is tell Finder to restart. Open Apple Script Editor, and put in the following to the blank window:

tell application ďFinderĒ
restart
end tell

Then go to the menu bar and click File. Click Save As, and change the format to Application. You also need to uncheck Never Show Startup Screen. Now save the file anywhere youíd like. After that, you can quit the Apple Script Editor.

Now you can set a Hot Key Function to your Apple Script Application. Click the Apple Logo in the menu bar, go to Control Panels, then Keyboard. Click Hot Function Keys... . Make sure both check marks under Hot Function Key Settings are checked. Click F1 and assign it to the Apple Script Application made previously.

To test it out, press F1. Now you have the ability to safely reboot if the mouse cursor freezes right after booting. Maybe this could be implemented in a future ISO.
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: IIO on February 16, 2020, 04:57:42 PM
why would you think that restarting the finder will reboot the machine?
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: alexfree on February 16, 2020, 05:38:26 PM
why would you think that restarting the finder will reboot the machine?

This is how it works in Apple Script, makes sense to me. If Finder goes down so does the OS. You can replace restart with shut down in the above script example and the resulting Apple Script Application shuts down the Mac instead.
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: Greystash on February 16, 2020, 06:36:28 PM
Thanks! I hadn't thought about doing this, I thought it was just my system being weird with the intermittent mouse freezes.
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: alexfree on February 16, 2020, 07:07:55 PM
Thanks! I hadn't thought about doing this, I thought it was just my system being weird with the intermittent mouse freezes.

I saw someone mention they do this in the Mac Mini G4 hacked Mac OS 9 ISO development thread, but they never explained all the steps to do so. I then did some research to figure out all the steps.
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: IIO on February 17, 2020, 12:12:18 PM
This is how it works in Apple Script, makes sense to me. If Finder goes down so does the OS.

nope, that is two different things.
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: alexfree on February 17, 2020, 02:09:20 PM
This is how it works in Apple Script, makes sense to me. If Finder goes down so does the OS.

nope, that is two different things.

Edit: iOS kept uploading a 0kb file with the files app >:( . Fixed the attachment by uploading via Photos app directly.

This attachment is a video of me opening the above script in Apple Script Editor and then executing it to reboot my Mac.
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: IIO on February 17, 2020, 03:30:01 PM
yes, thatīs how a reboot works.

but restarting the finder is something else than rebooting the OS. :)

Code: [Select]
try
tell application "Finder" to quit
end try
delay 5
tell application "Finder" to activate
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: IIO on February 17, 2020, 03:40:46 PM

regarding your idea:

it is probably a bit dangerous to use F1 to directly reboot.

how could one add another keyboard command to confirm or cancel before it actually reboots?

i am all but firm with applescript.
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: IIO on February 17, 2020, 03:45:50 PM
another question.

there are applications which require or allow to use the function keys themselves.

will that safely replace the hot function keys of OS9 just like they usually also replace F keys from third party controlpanels or other applications which are open in background?
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: IIO on February 17, 2020, 03:53:16 PM
Since you canít reboot without the mouse

and could you elaborate on this?

my mini reboots fine using the keyboard.

does that happen when the mouse freezes? (i cant induce a mouse freeze here now)
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: alexfree on February 17, 2020, 04:20:30 PM
Since you canít reboot without the mouse

and could you elaborate on this?

my mini reboots fine using the keyboard.

does that happen when the mouse freezes? (i cant induce a mouse freeze here now)

As far as I know, there is no way to reboot correctly and safely without using the mouse cursor to select restart. So if the mouse cursor freezes, I have no way to reboot but I do have access to the keyboard. When you say you reboot with the keyboard, how are you doing so without using the mouse cursor at all (other then what I do with the hot key).
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: alexfree on February 17, 2020, 04:25:10 PM
another question.

there are applications which require or allow to use the function keys themselves.

will that safely replace the hot function keys of OS9 just like they usually also replace F keys from third party controlpanels or other applications which are open in background?

Very good point! Iím honestly not sure. But as a workaround, since the mouse cursor freeze may only happen immediately after boot, you could just turn off the Hot Function Keys from within the keyboard control panel after a successful boot.

What are some specific applications using the function keys I could try that you know of?
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: alexfree on February 17, 2020, 04:29:31 PM

regarding your idea:

it is probably a bit dangerous to use F1 to directly reboot.

how could one add another keyboard command to confirm or cancel before it actually reboots?

i am all but firm with applescript.

You know, now that I think about it, I should figure out an alternative Apple Script that shows a dialog box with a confirm or cancel. That should work with just a working keyboard.
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: alexfree on February 17, 2020, 04:35:23 PM
yes, thatīs how a reboot works.

but restarting the finder is something else than rebooting the OS. :)

Code: [Select]
try
tell application "Finder" to quit
end try
delay 5
tell application "Finder" to activate

I see where the confusion came from.
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: IIO on February 17, 2020, 07:43:36 PM
i was just nitpicking the way you expressed it, for future reference. :P
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: IIO on February 17, 2020, 07:48:58 PM
When you say you reboot with the keyboard, how are you doing so without using the mouse cursor at all (other then what I do with the hot key).

just the normal keyboard command, which is command-alt-eject on every mac i know since 300 b.c.

you obviously missed that during the last 2320 years? :P

but as it seems we agree on all the other points. your approach is still an interesting contribution, so go on.
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: IIO on February 17, 2020, 07:53:14 PM
Very good point! Iím honestly not sure.

certain games might have a problem with that. or even 3rd party controlpanels/traps?

i believe most ego shooters make use of them. MM dreamwaver .. ? not sure now.

Quote
you could just turn off the Hot Function Keys from within the keyboard control panel after a successful boot.

you can probably even applescript that. :)
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: alexfree on February 18, 2020, 05:07:19 AM
When you say you reboot with the keyboard, how are you doing so without using the mouse cursor at all (other then what I do with the hot key).

just the normal keyboard command, which is command-alt-eject on every mac i know since 300 b.c.

you obviously missed that during the last 2320 years? :P

but as it seems we agree on all the other points. your approach is still an interesting contribution, so go on.

Yes I did miss that, thanks for letting me know. Just curious, since I donít have an Apple keyboard, how would I do this? I donít have an eject button.
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: ovalking on February 18, 2020, 01:41:10 PM
I'm not familiar with the MacMini mouse issue or Applescript.
However, I tried your tiny script. Saved it as an application and 'never show startup screen' checked.
Then navigated to and opened it via the keyboard (no need to play with F keys). My G3 gracefully shut down and restarted.
Could be useful if, for whatever reason, you have no mouse, or keyboard with a power button.
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: IIO on February 18, 2020, 01:50:37 PM
not sure how to do that with no eject button. (but see? there is the reason why his idea ist useful)

iīve been using mac keyboards with windows PCs but never the other way round.
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: alexfree on February 18, 2020, 02:55:48 PM
I'm not familiar with the MacMini mouse issue or Applescript.
However, I tried your tiny script. Saved it as an application and 'never show startup screen' checked.
Then navigated to and opened it via the keyboard (no need to play with F keys). My G3 gracefully shut down and restarted.
Could be useful if, for whatever reason, you have no mouse, or keyboard with a power button.

Iím glad you found this useful, and your right.
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: alexfree on February 18, 2020, 04:39:58 PM
not sure how to do that with no eject button. (but see? there is the reason why his idea ist useful)

iīve been using mac keyboards with windows PCs but never the other way round.

Here's a safer version of the script with your suggestions (not sure on how to turn off hot function keys automatically, there is no Apple Script Dictionary for the Keyboard Control Panel).

display dialog "Do you wanna reboot?" buttons {"Yes", "No"} default button "Yes"

if result = {button returned:"Yes"} then
   tell application "Finder" to restart
else if result = {button returned:"No"} then
   display dialog "Do you wanna open the Keyboard Control Panel to disable Hot Function Keys?" buttons {"Yes", "No"} default button "No"
   if result = {button returned:"Yes"} then
      tell application "Keyboard" to activate
   end if
end if
Title: Re: Tutorial : How To Set Up A Reboot Hot Key (For When The Mouse Bug Happens)
Post by: IIO on February 19, 2020, 04:36:30 AM
on atari you could move the cursor with the arrow keys. i sometimes missed that when jumping to OS7.