I have my computer set to wake me up with an audio book, and to remember the spot that it stopped at on the previous day. This is accomplished by using CronniX to run two Bash scripts that utilize the command osascript. The scripts are as follows:
In a file called book_op, enter this code:
#!/bin/sh
#
osascript -e "set volume 5"
open -a iTunes "$(cat ~/book_tn.txt)"
In a file called book_cl, enter the following code. Important note: The first osascript line below has been split into three lines for easier viewing here on macosxhints. Enter it as one long line, replacing each line break with a single space!
#!/bin/sh
#
osascript -e 'tell application "iTunes" to set floc to
(get location of current track)' -e
'set ufloc to POSIX path of floc' > ~/book_tn.txt
osascript -e 'tell application "iTunes" to stop'
The book_op script first sets the system volume to a reasonable level, so I wake and the neighbors don't. Next it opens the last track that was playing when the book_cl script was last run on the previous day. When the second script is run, the location of the current track is converted to a UNIX path and then saved it to a text file in your home directory called book_tn.txt. Then the script tells iTunes to stop. Save the scripts in two different files somewhere in your path, then type in terminal (the % should not be typed):
% chmod 755 book_op
% chmod 755 book_cl
This makes them executable files. Then open iTunes and find and play the current track that you want to hear when you wake up. Then in Terminal type book_cl. This should create the file book_tn.txt in your home directory and stop iTunes. Next check to see if it worked by typing book_op. This should start iTunes at the track you were just playing. Finally, use CronniX to set book_op to run at a good time to wake up, and book_cl to run at a good time to be out the door. Enjoy!
Mac OS X Hints
http://hints.macworld.com/article.php?story=2004120201255856