how to set wake up time - switch to schedule tab

Hi!
Does someone know how to set the wake up time in the System Preferences and turn on the checkbox for the wake up function ?
My script should work so far, but it doesn’t.
It opens the Energy Saver window, but it doesn’t switch to the Schedule tab.
BTW: I have 10.3.4

My script so far:

– iTunes alarm clock version 1.0
– written by Harald Leibbrand (HL @ HarryL . de)

– Just start the script. Set your wakeup time (4 digits)
– for example : if you want to crawl out of bed at 8am
– you need to enter 0800 in the dialog. Or choose one of
– your two favorite times via the buttons
– The time will be saved as your macs wakeup time
– in the Energy Saver Preferences pane.
– Then your mac goes directly in sleep modus.
– Your mac wakes up at the time you set.
– iTunes gets launched and starts playing.
– The volume will be raised slowly

– choose time
display dialog “Set alarm :” default answer “0700” buttons {“OK”, “8:00”, “10:00”} default button 1
copy the result as list to {text_returned, button_pressed}

– set the time in Energy Saver Pref Pane.

tell application “System Preferences”
activate
end tell
tell application “System Events”
tell process “System Preferences”
click menu item “Energy Saver” of menu “View” of menu bar 1
delay 3
tell window “Energy Saver”
if (exists tab group 1) then
tell tab group 1
click radio button “Schedule” – doesn’t work
delay 1
click checkbox “Start up the computer” – does this work ?

– how can i set the wakeup time with the time
– that was entered at the beginning of the script ?

end tell
end if
if exists sheet 1 then
tell sheet 1
click checkbox “Start up the computer”
end tell
end if

end tell
end tell
end tell

– Quit System Preferences
ignoring application responses
tell application “System Preferences” to quit
end ignoring
– start sleeping

– inactive during development: tell application “System Events” to sleep

– sleeping, waking up, start iTunes
tell application “iTunes”
if player state is not playing then
set sound volume to 0
play
end if
end tell

– slowly raise the volume
repeat with ix from 1 to 100
tell application “iTunes” to set sound volume to ix
delay 4
end repeat

yeah, i’m trying the same thing currently without any success…

Does anyone know a solution for this?

Thanks!

I’m running Tiger, and i get the same error with your script than i get with my attempts:

NSReceiverEvaluationScriptError: 4

The error occurs in the following line:

click radio button “Schedule” of tab group 1 of group 1 of window “Energy Saver”

This might be a Tiger issue…

Does anyone know what the error means?

Didn’t know that you can do this whith pmset… even better! Thanks!