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: kinnell on Apr 19, '06 09:54:28AM
I have a recurring iCal event which opens the following script:-


set volume output volume 100
set randomTrack to random number 500
tell application "iTunes"
	play track randomTrack of playlist "Library"
end tell
Change "Library" to the playlist of you choice, and 500 to a number less than or equal to the size of the playlist. If anyone knows how to determine the number of tracks in a playlist automatically, I'd love to hear about it :)

Another alternative would be to use launchd, or cron if you're old fashioned.

[ Reply to This | # ]

10.4: A simple alarm clock that plays an iTunes playlist
Authored by: openart2001 on Apr 19, '06 10:16:04AM

If iTunes is actively playing, you can ask iTunes to do the track counting for you in this manner:

tell application "iTunes"
set thisPlaylist to the current playlist
set totalTracks to the count of tracks of thisPlaylist
end tell



[ Reply to This | # ]
10.4: A simple alarm clock that plays an iTunes playlist
Authored by: sjmills on Apr 19, '06 11:58:18AM
Use the "some" keyword to pick a random object:

play some track of playlist "Library"

That way you don't have to worry about counting them and all that. Let iTunes do it for you!

[ Reply to This | # ]

10.4: A simple alarm clock that plays an iTunes playlist
Authored by: TomAlperin on Apr 20, '06 08:15:44PM

I liked the idea of using iCal, but it was easy enough to use automator to get the same results without having to worry about how many tracks are in the playlist and changing the script every time I add tracks.

One thing does still bother me about using iCal this way. I can make one repeating event that only applies to certain days of the week and it's not a problem that my computer wakes up when there really isn't an alarm to play as it will simply go back to sleep in a few minutes, but what are you supposed to do if you have a later or earlier wake-up time a couple days a week? It would be nice if iCal could wake my portable as long as the screen was up. I suppose I could use the desktop to send music through Airtunes to the speakers in my room, setting it to never go to sleep, but that's going to be torture if I need to walk into an entirely different room to turn the music off. Yes, I can use the remote to turn off the speakers, but that eventually will lead to me leaving music running with the speakers muted. All I need is for a cordless phone/microwave incident to switch things back to computer speakers and I've got a nasty phone call from home right in the middle of work.

If it's possible to communicate with iCal through Applescript, it should be possible to write a program that will check to see what the next iCal alarm is and wake the computer so that whatever the alert is occurs at the appropriate time instead of the next time you manually wake the computer.

If not this, it sure would be nice if you could at least have different wake times for different days.



[ Reply to This | # ]