Re: Trying to tweak an iTunes VBScript
- From: "Paul Randall" <paulr901@xxxxxxxxxxxx>
- Date: Tue, 8 Jan 2008 09:14:52 -0700
I too am not an iTunes user or I would have used TLViewer to look at
the COM interface. I appreciate your posting the URL. The help file
gives me a feel for what iTunes is capable of, but it is not an easy
read. Before seeing this thread I didn't know iTunes was scriptable.
-Paul Randall
"Trevor Sullivan" <pcgeeknosp4m86@xxxxxxxxx> wrote in message
news:ettT6aeUIHA.5288@xxxxxxxxxxxxxxxxxxxxxxx
Paul,
I don't know if it would help, but you could load the type library
into a type library viewer, such as Visual Studio or even the Visual
Basic Editor included with Microsoft Office. This might give you a
better visual representation of what the SDK is capable of.
Glad to hear you're getting some results though. I haven't used the
SDK myself, as I am not an iTunes user, but I figured I would send
the link your way anyway! :)
----------------
Trevor Sullivan
Systems Engineer
Paul Randall wrote:
"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
.
- References:
- Trying to tweak an iTunes VBScript
- From: Andrew
- Re: Trying to tweak an iTunes VBScript
- From: Paul Randall
- Re: Trying to tweak an iTunes VBScript
- From: Trevor Sullivan
- Trying to tweak an iTunes VBScript
- Prev by Date: Re: making this windows script?
- Next by Date: Re: Window.Event.keyCode Problem
- Previous by thread: Re: Trying to tweak an iTunes VBScript
- Next by thread: list of function
- Index(es):
Relevant Pages
|