Ever wished you could tell iTunes to stop playing your music after a little while? Here’s how to make a sleep timer with AppleScript:
display dialog “How many minutes until I pause iTunes?” default answer 10
delay ((text returned of result) * 60)
tell application “iTunes” to pause