Re: iTunes play property
Re: iTunes play property
- Subject: Re: iTunes play property
- From: garbanzito <email@hidden>
- Date: Sat, 20 Apr 2002 12:54:30 -0600
at 2002 04 20, 04:04 -0700, they whom i call Lee Azzarello wrote:
Hello all. I'm new. To this list and to AppleScript (wow, AppleScript
looks so much like English, he said at first glance).
you may find this resemblance quite deceptive ...
tell application "iTunes"
activate
set bumper to the track named "station-id" in library playlist
play bumper
end tell
this does not work. It produces an error like so:
"can't get track named "station-id" in library playlist."
the crucial factor is knowing the hierarchy of objects in an
application. an iTunes playlist is not a top level
application object, so you have to refer to it by way of the
object that contains it, which is a "source". this may not
be obvious from reading the dictionary, though you can see
it by tracing which classes can be elements of other
classes. it is much easier to see if you use something like
the Object Model and Explorer views in Script Debugger.
reviewing sample scripts (of which there are many for
iTunes) can also help.
try this line in your script, i think it will work:
set bumper to track "station-id" in library playlist 1 of source "Library"
key points: a) source "Library" is the top level object
which contains the library playlist. and b) there is only
ever (i think) one library playlist, but you still have to
refer to it by index, name or id. in this case it will
always be
library playlist 1
you could also use
playlist "Library"
because this playlist's name can't be changed. but if you
have more than one playlist in your library, it may not
always be
playlist 1
The track's there. It's in the Library path I defined in the prefs AND in
the default Library in my home dir, just to be safe. iTunes won't see it.
In fact, I can't play ANY track in the Library by name.
if you can play "station-id" from the iTunes GUI, the
problem is purely how you're referring to the tracks, not
whether iTunes sees them. you can put the audio files
anywhere, just drag them into iTunes and iTunes will
remember them, even if you later move them somewhere else on
the same volume. i have thousands of tracks on two drives.
none of them are in my iTunes "Music Folder".
--
steve harley email@hidden
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.