Re: Trying to tweak an iTunes VBScript
- From: "Paul Randall" <paulr901@xxxxxxxxxxxx>
- Date: Mon, 7 Jan 2008 20:28:17 -0700
"Trevor Sullivan" <pcgeeknosp4m86@xxxxxxxxx> wrote in message
news:OypuSBRUIHA.5496@xxxxxxxxxxxxxxxxxxxxxxx
Paul,
Here is a link to the iTunes SDK:
http://developer.apple.com/sdk/itunescomsdk.html
----------------
Trevor Sullivan
Systems Engineer
Thanks, Trevor
I extracted the iTunesCOM.chm help file from the SDK download file.
I'm just guessing here, but it looks like it is aimed at those who
directly access the iTunes object through a DLL. There are some
sample JScripts that access the iTunes object through the COM object,
with scripts like this:
var iTunesApp = WScript.CreateObject("iTunes.Application");
var mainLibrary = iTunesApp.LibraryPlaylist;
var mainLibrarySource = iTunesApp.LibrarySource;
var tracks = mainLibrary.Tracks;
var numTracks = tracks.Count;
var numPlaylistsCreated = 0;
var i;
// FIXME take a -v parameter eventually
var verbose = false;
// first, make an array indexed by album name
var albumArray = new Array();
for (i = 1; i <= numTracks; i++)
{
var currTrack = tracks.Item(i);
var album = currTrack.Album;
....
To me, this means that there are properties, or methods named:
LibraryPlaylist
LibrarySource
Tracks
Searching the help file for LibraryPlaylist , I get:
HRESULT IiTunes::LibraryPlaylist (
[out, retval] IITLibraryPlaylist ** iLibraryPlaylist )
With a change in mindset, perhaps I could figure out how to get some
method and property info that could be used by VBScript. Maybe I've
been spoiled by Microsoft's object documentation like that they
provide online for the DHTML DOM.
I suspect it would be relatively easy to get a list of tracks, if you
can decipher the help file.
Perhaps something like:
Set oiTunesApp = WScript.CreateObject("iTunes.Application")
Set omainLibrary = oiTunesApp.LibraryPlaylist
Set oTracks = omainLibrary.Tracks
For Each oTrack in oTracks
MsgBox "Album = " & oTrack.Album & vbCrLf & _
"Artist = " & oTrack.Artist"
Next
I was hoping to find a name property for tracks, but I didn't see it
in the list of 30-some properties listed in the help file, but I may
have missed something or the documentation may be incomplete. If
there is a name property for tracks, TLViewer should list it.
-Paul Randall
.
- Follow-Ups:
- Re: Trying to tweak an iTunes VBScript
- From: Trevor Sullivan
- Re: Trying to tweak an iTunes VBScript
- References:
- Trying to tweak an iTunes VBScript
- From: Andrew
- Trying to tweak an iTunes VBScript
- Prev by Date: Re: list of function
- Next by Date: RE: IE7 command line arguments
- Previous by thread: Re: Trying to tweak an iTunes VBScript
- Next by thread: Re: Trying to tweak an iTunes VBScript
- Index(es):
Relevant Pages
|