Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the '10.4: A simple alarm clock that plays an iTunes playlist' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: A simple alarm clock that plays an iTunes playlist
Authored by: Frig on Apr 30, '06 04:38:26AM

I've also written an AppleScript, which invokes iTunes and a special playlist. It also checks if the playlist is existent and if not creates one.

I'm currently using it with iCal where I've alarms which start this script.

This AppleScript has some features which are deactivated at the moment. For example if the playlist has no items, it could search the library for a text and add the the tracks to the playlist, which match the text.
Another feature you could use is that it checks every 10 seconds if you're awake (if you stopped or paused the iTunes) and do an action.

Just feal free to modify and/or use the Applescript

set playlistname to "alarm clock"
set volume 10
say "Good morning!"
tell application "iTunes"
--set minimized of browser window 1 to false
set sound volume to 100
set view of front window to user playlist "Wecker"
if duration of playlist "Wecker" = 0 then
--set view of front window to library playlist
--set mytracks to search library playlist for "some text"
--duplicate every track of mytracks to user playlist playlistname
duplicate every track of library playlist 1 to user playlist playlistname
end if
play playlist playlistname
set song repeat of current playlist to all
set advertisetime to 30
set awake to false
repeat while awake = false
--say "Get up!"
set x to 1
repeat while (x < advertisetime)
delay 10
set x to (x + 1)
if player state is paused or player state is stopped then
set awake to true
exit repeat
end if
end repeat

end repeat*)
end tell
on error
display dialog "Error on executing Alarm!"
end try

[ Reply to This | # ]