Hello there!
I have a few answers for you that should help you out and make this a very useful tool for you. However, I do not want to take any accountability if messing around with shell scripts hurts your computer. There are many risks in doing this. But these instructions should help you quite a bit (especially if you are a beginner at the Terminal, like myself 😉 )
1. It seems you have installed Sleepwatcher correctly. If, by chance, these instructions do not work, I suggest reinstalling Sleepwatcher via MacPorts. MacPorts is one of the most effective and simplest ways to install Terminal based add-ons. First, of course, install MacPorts, which is as easy as downloading a package and running it. To install Sleepwatcher via MacPorts, simply type in the command line:
sudo port install sleepwatcher
then type: sudo port load sleepwatcher
Sleepwatcher will then automatically be installed and loaded.
2. You need to actually convert your AppleScripts into a Shell Script (they are not the same). The way to do this is to load it into the .sleep or .wakeup script that you desire to be placed in your Home folder. The way to do this is to do the following:
To Create a Script to be Run When Your Computer Goes to Sleep/Wakes Up:
a.) type in a new Terminal Window:
cat > $HOME/.wakeup
then
#!/bin/sh
b.) The next thing to understand is that you can run Applescripts through Terminal, via something called osascript, which is a command given within the Terminal. If your Applescript is fairly simple (just ejecting a disk or opening a new Finder window), I would go ahead and write that in osascript language. To gain a better idea of what that means, go to this website. However, it looks like you've saved your Applescript as a file. This next solution might be a little bit simpler. The following will help you just run your Applescript from the file you've saved it as (assuming it is a .scpt or something).
After typing the above commands, type: osascript followed by a space. Then drag your Applescript file to the Terminal window. Thus, your command should look something like: osascript /path/to/desired/script
c.) Hit enter.
d.) Hit ^D (Ctrl-D)
e.) Then type chmod +x $HOME/.wakeup
To do this for a script that runs when put to sleep, replace everything above that says ".wakeup" with ".sleep"
NOTE: If your script requires some sort of User Input (i.e. a display dialog, etc.), it will not be able to be run from within the Terminal. So, a workaround for this is to create an Application in Automator. I'm assuming you know how to do this, but if not, just start a new Application and drag the workflow "Run Applescript". Then copy and paste your Applescript text from your "WakeDialogForReceipts" (or whatever script you want) and save it as an Application in your Applications folder. Then, when typing the osascript in Terminal for the .wakeup script, type:
osascript -e 'tell application "WHATEVER YOU NAMED YOUR AUTOMATOR APPLICATION" to activate'
Then finish the rest of the steps above.
I hope this helps! I'll check back here often to make sure that you got the answer you were looking for! I just recently figured this out, and it has changed my life!
I must give all the credit to the MintyFresh blog. Their descriptions helped me a ton! Go there for more insight on Sleepwatcher and other things!