views:

714

answers:

2

This isn't about a specific language, since it is more about the iTunes COM interface. I have managed to add a file to the library with .AddFile(), but now that the file is there I'd like to read some details about it such as the artist, song, and album. Since the song doesn't automatically play, I can't really use CurrentTrack() to read the properties. Is there a way to get the last file added?

+2  A: 

The "return value" (actually the last parameter, since this is COM we're talking about) for AddFiles is an IITOperationStatus interface pointer. That is the key to finding out what happened.

You should call the InProgress() method on this interface to make sure the operation has completed. (If iTunes has to copy the file, it might proceed asynchronously).

Once it is complete, you can use the Tracks property on this interface to get an IITrackCollection that represents the track(s) you just added.

(I would have hyperlinked all those interface and method names, but it does not appear Apple has the iTunes COM SDK documentation posted online in a linkable form. See the iTunesCOM.chm file you got with the SDK for details).

Tim Farley
+2  A: 

I know this question is very old but...

If you are still interested in the iTunes COM and autoit check out this iTunes user defined function set by torels of autoitscript.com. A very deep dive into the iTunes COM any language you want to implement iTunes COM manipulation in this can be your guide.

Copas