Code

Display Currently Playing iTunes Track On Your Desktop With Rainmeter

Earlier this evening I read a Lifehacker post on how to display the currently playing track in iTunes on your desktop with Rainmeter.  Many of the commenters had the same complaint as me: that it seemed needlessly complicated.  Remembering having read about how to script iTunes on, of all things, a Microsoft webpage, I decided to set about creating a solution of my own.  This is the result, a simple script that I think should run on any Windows PC that iTunes will.

Display the currently playing track in iTunes on your desktop with Rainmeter

Simply run the script to begin monitoring iTunes (which doesn’t have to be running yet).  When a track is playing, its title, the artist, and album will be written to a user-specified file, which can then be displayed on the desktop using Rainmeter (a sample skin is provided below).  If iTunes is stopped or closed, the file will be cleared, leaving a blank space on the desktop.

By default, the file used is D:\rainmeter_itunes_playing.txt, and checks are made every 2 seconds.  Change these values if they’re not suitable for your particular setup.

WARNING: Vista will not be happy if you change it to C:\rainmeter_itunes_playing.txt—instead use C:\Users\YOUR_USERNAME\rainmeter_itunes_playing.txt, where YOUR_USERNAME should obviously be replaced by your username. And remember to change the Rainmeter skin file to match.

If you need to stop the script for whatever reason, you’ll have to use Task Manager and select wscript.exe, then click End Process.

All files are released under a GPLv3 licence.

Comments

  1. Hi I was wondering if there was anyway you can tell me how to run the script to monitor iTunes. I am kind of lost.

    Or could you make a video showing how to?

    HuffPCair

    Saturday, 28th March 2009 05:19:59

  2. Assuming Windows isn’t blocking it as a potentially harmful download, it should just be a matter of double clicking the downloaded file. To see if it needs to be unblocked, try right-clicking, and choosing Open. A warning message will probably pop up if that’s the case.

    But it could just be that you’ve got it running and haven’t realised it since it runs in the background with no obvious “Hey, I’m running now” message. To confirm whether it is running, look for the automatic creation of the file specified in the script (D:\rainmeter_itunes_playing.txt unless you’ve changed it) and/or wscript.exe appearing in the list of processes in Task Manager (Ctrl-Alt-Del to launch).

    Marc

    Saturday, 28th March 2009 08:11:10

  3. See thats my problem my D drive is for my dvd drive unless it is running off CDs playing. Then when I look in C drive I have no file called anything close to rainmeter_itunes_playing. So I am kind of lost. Like where should I extract the files since they are zip files and all that?

    HuffPCair

    Saturday, 28th March 2009 20:51:02

  4. Also when I go to open the script it tells me there is an error on line 48 char 2.

    HuffPCair

    Saturday, 28th March 2009 20:53:52

  5. I’ve come to the conclusion you’re using Vista, and have changed D:\ to C:\. Right? It’s the line 48 char 2 that gives it away. The problem is that Vista is very protective of the root of the C drive. So try:
    FILENAME = “C:\Users\YOUR_USERNAME\rainmeter_itunes_playing.txt”
    where YOUR_USERNAME should be replaced by your username, obviously.
    That should fix it for you. If so, remember to change the filename in the Rainmeter skin too.

    As for where to extract the zip file, I keep my files in the Rainmeter Skins directory, with a shortcut to the script in my Startup folder so it starts automatically whenever I log on, but anywhere in your user space, e.g. Downloads, should be fine.

    Marc

    Saturday, 28th March 2009 22:50:52

  6. Awesome thank you very much and thank you for your fast replies. Awesome work and I hope its cool that I am changing some of the stuff on how it looks.

    Thanks again
    Huff

    HuffPCair

    Sunday, 29th March 2009 00:16:41

  7. Change away, by all means. That is, after all, the purpose of open source. And thanks for your feedback—I’ve already used it to clarify the main text.

    Marc

    Sunday, 29th March 2009 00:23:05

  8. Awesome. Well you made an awesome script and I am loving it so far. Designed it around the HUD skin with some of my own touches.

    HuffPCair

    Sunday, 29th March 2009 00:55:17

  9. Great script, much easier then the other local web server one.

    BaconLePew

    Monday, 6th April 2009 02:26:00

  10. Why do I keep getting errors although it works totally fine?

    carbonaddictxd

    Monday, 13th April 2009 14:08:21

  11. Without knowing what exactly the errors you’re getting are, it’s difficult to say.

    Marc

    Monday, 13th April 2009 16:02:26

  12. owh….i will wait for it to come out again and post it here….anyway is there a way to display the album art? it would be really great

    carbonaddictxd

    Monday, 13th April 2009 17:51:03

  13. anyone has the same problem that rainmeter keeps crashing after using this method?

    carbonaddictxd

    Tuesday, 14th April 2009 14:46:32

  14. I did have a problem with Rainmeter crashing on one computer. I suspected it was down to a file-access conflict, so I made SECONDS_BETWEEN_CHECKS = 5 in the VBScript, and Update=3000 in the Rainmeter config. Since 3 and 5 are prime numbers, the chance for conflicts is significantly reduced. It worked for me.

    Marc

    Tuesday, 14th April 2009 20:35:29

  15. It still crashes although I follow your method…Thanks anyway.

    carbonaddictxd

    Wednesday, 15th April 2009 16:59:04

  16. Ok I am back and I have a problem. It has been crashing on me for some reason. I looked it up and its on line 42 char 2

    The line reads as follow:
    Set f1 = fso.CreateTextFile(FILENAME)

    Then the Error is the requested operation cannot be performed on a file with a user-mapped section open.

    Hopefully you will be able to help me on this.

    HuffPCair

    Thursday, 16th April 2009 07:27:00

  17. @carbonaddictxd: Try running Rainmeter as an Administrator; apparently that prevents various types of crashes.

    @HuffPCair: Unfortunately, that’s not an error I’m familiar with, and haven’t been able to replicate it. Did you edit/move any of the files just before you started getting the error?

    Marc

    Saturday, 18th April 2009 00:59:06

  18. i love the idea of this, but can’t get it to work. i’m not a total noob; i’ve changed the working directory to c:\ as that is my root drive. i’ve verified that there is a txt file being created and updated with info called rainmeter_itunes_playing. the only problem is that it’s not displaying on the desktop. any help would be appreciated. it’s prolly just something i’m overlooking. i never said i wasn’t an id10t

    Beasy

    Tuesday, 19th May 2009 20:48:31

  19. Getting an error as well. I haven’t tried running as administrator, but I’ll try that.
    Line: 76
    Char: 3
    Error: Call was rejected by callee.
    Code: 80010001
    Source: (null)

    Llevel

    Thursday, 21st May 2009 18:38:21

  20. Good stuff! Works like a champ!

    Domenick

    Friday, 5th June 2009 02:17:59

  21. So how would one go about making it show album artwork?

    Stefan

    Tuesday, 16th June 2009 03:38:59

  22. This one is a lot simpler:
    http://www.rainmeter.net/forum/viewtopic.php?f=18&t=47

    No VBS scripting necessary!

    Matt

    Saturday, 27th June 2009 13:35:19

  23. @Matt: Yes that certainly is simpler, and probably better generally, but it wasn’t available when I did this. I actually started writing a plugin myself shortly after, but have never finished it because, well, I don’t like C and I have better things to do.

    Thanks for the info and link.

    Marc

    Sunday, 28th June 2009 16:10:42

  24. Line: 76

    Char: 3

    Error: Call was rejected by callee.

    Code: 80010001

    Source: (null)

    Same problem as Llevel. Plugin works fine, but when I close iTunes, it asks me if I want to quit as one or more scripts are using iTunes. I say yes and this error occurs. Help please? This skin has potential

    Adam

    Monday, 29th June 2009 19:41:26

Leave a comment
Your Information




Your Comment

XHTML: You may use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>