Filed under: Audio, Features, Windows, Productivity, Apple
How to make a poor man's alarm clock with iTunes on Windows
Every media player ought to include a simple alarm clock, but unfortunately with iTunes that's not the case. Certain plugins and third-party programs exist that get the job done, but for iTunes on Windows, at least, they are either of questionable quality or cost money. Fortunately, it's possible to get rudimentary alarm clock functionality in iTunes for Windows with little more than a text editor. Instructions after the jump.
Create the JScript
First, we have to create a JScript (Microsoft's version of JavaScript which can be used to control and interact with some Windows applications, including iTunes) file that tells iTunes to start playing. Start Notepad and enter these two lines:
var iTunes = WScript.CreateObject("iTunes.Application");
iTunes.Play();
The first line says, "create a JScript object that I can use to control iTunes," and the second tells that object to make iTunes play. Save the file with a sensible name ending in ".js," like "iTunesPlay.js," making sure that Notepad doesn't automatically add ".txt" or anything else to the end of the filename.
Test the script
Now we can test to see if our new script works. Go to Start and Run and enter "wscript" followed by a space and then the full path to the script you created. If there are any spaces in the path, you may need to enclose it in quotation marks, e.g.:
wscript "C:\Documents and Settings\Jordan\scripts\iTunesPlay.js"
Make sure your speakers are on and iTunes isn't already playing and click "OK." Your iTunes should begin playing whatever song is currently queued up.
Set the alarm
In order to make iTunes play at a particular time, all we have to do is use Windows' Task Scheduler to schedule our script to run at that time. Go to the Control Panel and Scheduled Tasks and choose "Add Scheduled Task" to lonk the Scheduled Task Wizard. Click on "Next" and on the choose-a-program screen click on "Browse..." Browse to your Windows folder (usually c:\windows or c:\winnt) and then the system32 folder. In system32 double-click on wscript.exe. Back in the Scheduled Task Wizard, give your task a name like "Play iTunes" and pick how often you want the task to run. If you want it to run every day or every weekday choose "daily;" if you only want it to run on, say, Tuesdays, Wednesdays, and Fridays, choose "weekly." Then click on Next. On the next screen you can tell it what time you want the script to run and what date you want the task to start. Set your options and click Next.
On the next screen you'll have to enter your Windows login and password. The Wizard ought to fill in your login name for you, so enter your password twice and click Next. On the last screen it will confirm your settings. Check the "Open advanced properties for this task when I click finish" box and click Finish.
In the Properties dialog that opens you'll see that the "Run" box shows the path to wscript.exe, but we still have to point it to our script; otherwise, it will do nothing. Immediately after "wscript.exe" enter a space followed by the full path like you used before, again in quotes if necessary. Make sure it is the name of this script, e.g. "iTunesPlay.js," is included. Now click OK. You may be prompted to enter your password again, and then you're done! If you want, you can test your task by right-clicking on it and choosing "Run." You can change the schedule any time by double-clicking on the task and going to the Schedule tab.
Further reading
For more information on Windows Scripting Host, which you just used to make a text file control an application, take a look at the Scripting section on MSDN. For more information on controlling iTunes with scripts in Windows, Apple's iTunes COM for Windows SDK has documentation and example scripts.
So, just how good at time waster games are you? Think you've got the stuff? Well, The World's Hardest Game 2.0 doesn't think you do.
Yes, amazingly, it's possible to have a sequel to a game called "The World's Hardest Game". It doesn't seem logically possible, since if the first one was actually the world's hardest, how could another one come along and share the moniker? It made me doubt the name in the first place. That is, until I tried the game.
The mechanics of the game are very simple. You are a small red square, ...

Reader Comments (Page 1 of 1)
Chad said 12:21PM on 10-11-2005
I don't understand why "Every media player ought to include a simple alarm clock."
This is the kind of thinking that leads to horrible client applications. Just my thoughts.
Reply
Mike Whalen said 1:02PM on 10-11-2005
"Poor Man's Alarm Clock?!" On a MACINTOSH?! WTF?!
I kid. I kid.
Reply
Steven said 1:41PM on 10-11-2005
Questionable quality or cost money? I think not. I wrote iSnooze quite some time ago, released it GPL, and have been using it as my sole alarm for a very long time. Looks like a "sleep timer" is my most requested feature, and it hasn't been added, but as an alarm it's great (IMHO).
Reply
illogic said 2:04PM on 10-11-2005
i've been using isnooze myself as my primary alarm clock (i need more than one) for months now. it's a nifty little application.
Reply
Billy said 2:38PM on 10-11-2005
You don't need to write your own scripts, there's a pretty comprehensive set here:
http://maximized.com/freeware/scriptsforitunes/documentation.htm
I have two scheduled tasks set up. One starts iTunes playing my chosen play list about 20 minutes before I need to get up and it turns the sound all the way down. The other increases the volume every two minutes until it hits the max. Much better to wake up to then an alarm clock.
Reply
Drewsky said 3:29PM on 10-11-2005
Inspired by this, I created a batch file for WMP and set it up as a schduled task on my son's PC (7am weekdays). He's kind of hard to wake up, but this should work well. I mean Metallica is a great way to wake up, right? Here is the command:
"C:Program FilesWindows Media Playerwmplayer.exe" "V:MusicMy PlaylistsAlbum- Metallica, Reload.wpl"
Here are some resources:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/commandlineparameters.asp
Anyone have any ideas on how to adjust the volume in WMP from a batch file? I did not see anything in the reference.
Reply
MasterSauce said 9:26PM on 10-11-2005
This is rediculous...Why not just schedule an mp3 to be opened by iTunes?
Run: stoplisteningtobadmusic.mp3
Start In: iTunes.exe
Its worked for me this morning and about every morning for the past 2 years. Let's move up to the next level.
Reply
Jordan Running said 9:46PM on 10-11-2005
MasterSauce: What if you want to wake up to a different song tomorrow? How many steps does it take you to change it if you're not sure of file's full path?
Reply
MasterSauce said 10:11PM on 10-11-2005
Well I've also set it to playlists, and those are easy to change within their associated program.
But I guess now that I've said that, I realize that I have no idea how to do that with iTunes...Hmm...
I just think this is a pretty trivial thing and not nearly as complicated as to warrant making jscript files. Does it really take a 523 word explanation to set an alarm on a PC with iTunes? I thought not...
At any rate, set your alarms to pi o'clock tonight, (3:14 for those who don't know) and dance naked in honor of all things geek.
Reply
Ryan said 3:11PM on 10-16-2005
What about a Konfabulator or Dashboard Widget? I like Konfabulator for the cross-platform goodness.
Reply