Nate's Scripts for iTunes for Windows

Hi. I've set up this page to share a couple of helpful scripts for the Windows version of iTunes. I wrote these scripts using the JScript implementation provided by the Windows Scripting Host (WSH), using the objects documented in the iTunes COM for Windows SDK.

Feel free to use and adapt as you wish. If you redistribute, please try to provide a link or note back to this site. You can try to reach me if you have problems or questions, but I'm not promising that I'll have time to help (or even answer).

You do not have to download the SDK to use these scripts, but if you're curious about it you can download it from Apple's developer site.

If you have the MacOS version of iTunes or iPod, then you can't use these scripts. But the Mac versions are also scriptable (via AppleScript), and you'll find similar scripts elsewhere on the web.

Script: "SendAudioTracksToDevice"

I like to play music from CD's on my iPod. I don't care about having the digitized versions of the songs on my computer's hard drive, or having them listed in the iTunes library. I just want to get the music onto my iPod, without cluttering up my computer with a bunch of excess files.

But I find that the process of getting this result in iTunes is tedious and completely unintuitive (to me). First I have to select the CD, then hit Import, wait for the encoding to finish, select the Library, find and select the songs I just added (ugh), drag them to my iPod, wait for the transfer to finish, delete the songs from my library, and finally answer the question about deleting the underlying music files from my computer's drive.

To that end, this script transfers all the songs on an Audio CD directly to your iPod. If all goes well, it will do so without leaving the songs in your iTunes library or on your computer's drive. Internally, it has to go through most of the same steps we humans would (import the songs into the library, transfer them to the iPod, then delete them from the library and computer), but it does so with just one click and it does it unattended.

Download and Usage

First, download this zip file and extract its contents into some folder on your computer. It doesn't matter where, but you might want to put it in your iTunes program directory (probably c:\Program Files\iTunes). You should now see two new files.

Now run the script by double-clicking on the SendAudioTracksToDevice.bat file (you may not see the ".bat" part, depending on your computer is set up). That's it! You should start seeing some progress messages.

If you want a shortcut, just right-click on that same file and choose Create Shortcut. Then drag the shortcut onto your Desktop or Start Menu or whatever. Now you can run the script by just clicking the shortcut.

If you need to cancel the operation, hit Ctrl-C. Note that you'll have to cleanup any files that have already been imported but not transferred to your iPod yet. Just use the iTunes application to do that, as you would normally.

You can ignore the other file (the one that ends with "Script") unless you want to run the program from the command line. To do so, type cscript SendAudioTracksToDeviceScript.js and hit Enter.

Problems and Imperfections

This thing isn't perfect. If it gets stopped because you hit Ctrl-C or because of some kind of problem, any music files it will have created already will remain on your computer and in the library. You will probably also have to stop the import process in iTunes yourself; it won't stop importing just because the script has been aborted. I'm sure it will show strange errors if there is no CD in your drive, and so on. But if you use it as expected it should be helpful.

System Requirements