If you're using 10.4.3, you may have already tried out enabling Safe Sleep on your computer using the tips from Andrew Escobar's blog. I found it works great on my Powerbook G4 867, but I didn't want to have to keep using the Terminal to switch it from hibernatemode 3 (computer uses regular sleep, only Safe Sleeps in extreme situations) to hibernatemode 1 (goes straight into Safe Sleep).
So I wrote an AppleScript application that flips the machine to mode 1, sleeps the machine, then turns it back to mode 3 upon awaking, so that I can use Safe Sleep on demand.
The code is as follows:
do shell script "/usr/bin/sudo -k;/usr/bin/sudo /usr/bin/pmset -a hibernatemode 1; /usr/bin/sudo -k" password ¬
"_password_" with administrator privileges
ignoring application responses
tell application "Finder" to sleep
do shell script "(/bin/sleep 15 && /usr/bin/sudo -k && ¬
/usr/bin/sudo /usr/bin/pmset -a hibernatemode 3 ¬
&& /usr/bin/sudo -k) &> /dev/null &" password ¬
"_password_" with administrator privileges
end ignoringSave this as a Run Only application with no Startup Screen, and you've got a great Dock item to use when swapping a battery with no power cord (or whatever).
As an added bonus, save it as an Application Bundle type (in the Save dialog), and then edit the Info.plist file you'll find inside the application's package, and add these lines:
<key>LSUIElement</key>
<string>1</string>
Now you have a handy faceless application, suitable for use with your favorite keystroke launcher.
Things to adjust:
- Need to put your administrator password inside -- replace _password_ with your admin password. If you want the program to ask you each time, just remove the password "_Password_" argument altogether.
- You may want to play with the sleep value of 15 seconds in the second shell line. This may be too long for your tastes.

