Alarm Clock

I want to make an alarm clock with my G5, but don’t quite know how. I am in university, and I seem to become ‘immune’ to my alarm clocks after a short amount of time, and I hope that songs will change this. Any help is appreciated. First off, I have all my courses in iCal, and they start at various times. I would like to get up about an hour before the first one. Also, I would really love it if the startup noise wasn’t there, so I would assume the only way to do that is to set the volume to 0 before shutdown, and then change it again when it has started up?

Next, I would like iTunes to start, and play a random song out of the Alarm playlist.

Here is what I have so far:
For the shutdown script (is it possible to automate a shutdown script?)

set volume of 0

for the startup, and iTunes

set volume of 2.5
tell application "iTunes"
	activate
	tell source "Library"
		tell playlist "Alarm"
			set randomtrack to some track
			play randomtrack
		end tell
	end tell
end tell

I used some (most) of a previous script I found on the internet for the second one. However, iCal isn’t integrated with it. I think that iCal can startup the computer based on the events, but how would I go about adding the applescript?

EDIT: If it is easier, I can keep my computer on sleep mode, and create an identical calendar to the one I have just 1 hour earlier and make the action based on that. . . I’ll try it, and hide the calendar.

Model: PowerMac G5
Browser: Safari 412.5
Operating System: Mac OS X (10.4)

The Energy Saver Preference Pane can wake up your Mac before you want your alarm to go off. Save the iTunes script. Using iCal, setup a recurring event and set the alarm to open a file, selecting the script you have written by choosing Other… from the drop down just below Open File . iCal does not have to be open for the script to be triggered.

Here’s a how-to on Apple’s applescript site:

http://www.apple.com/applescript/ical/01.html

HTH
Craig

Okay, that’s what I’ve done. I’ve tested it, and it works very nicely:)

Just one question… if there is an alarm, and my PowerMac is on sleep, will it wake? I’d assume so to be a true alarm.

is there any way of ‘scripting’ the sleep timer in systerm preferences, so I can change it at will?

This will do it (the zeros are equivalent to never):

do shell script "sudo pmset spindown 0 dim 0 sleep 0" password "your_password_here" with administrator privileges

The shortest setting for dimming the screen, spinning down hard disks, and sleeping the CPU is 1 minute (because zero means never). You don’t have to include them all. To see what else pmset does see man pmset in the terminal or get bwana and see it in Safari.