Back in May, I posted about Automating/scripting iTunes on Windows. I noted how it would be easier if IITTrackCollection implemented IEnumerator so you could use foreach. Well, Apple listened, and in iTunes 4.7, it does! Now, you can just write:

using System;

using iTunesLib;

 

namespace TrackLister

{

    class Program

    {

        static void Main(string[] args)

        {

            iTunesApp app = new iTunesAppClass();

 

            foreach (IITTrack track in app.LibraryPlaylist.Tracks)

            {

                Console.WriteLine("{0} by {1}", track.Name, track.Artist);

            }

        }

    }

}

 

Thanks, Apple!

 

Dan