Re: Controlling iTunes Remotely
Re: Controlling iTunes Remotely
- Subject: Re: Controlling iTunes Remotely
- From: Chris Garaffa <email@hidden>
- Date: Fri, 18 Jul 2003 12:59:19 -0400
On Friday, July 18, 2003, at 12:33 PM, Matthew Smith wrote:
The other, although I have not
encountered it, is where there is more than one track in the playlist
with
the same name, or even two playlists with the same name. I am not sure
how
to resolve them
The best way to go about this would be to use the database ID property
of a track and index property of the playlist. For example,
tell application "iTunes"
set oneTrack to item 1 of selection
set tdbid to database ID of oneTrack
set c1 to container of oneTrack
set ci1 to index of c1
set c2 to container of c1
if kind of c2 is shared library then
tell application "iTunes" of machine "eppc://g3desktop.local."
play the first track of playlist ci1 whose database id is equal to
tdbid
end tell
else
display dialog "The selected track is not on a shared library" buttons
{"OK"}
end if
end tell
Note, however, that the database ID of a track can change while iTunes
is running, for example, when the shuffle order is changed. To remedy
this, you'll want to add
set fixed indexing to true
at the beginning of your script. If you want to return fixed indexing
to is previous state when the script ends, add
set oldFixedIndexing to fixed indexing
set fixed indexing to true
to the beginning, and
set fixed indexing to oldFixedIndexing
at the end (inside a tell block, of course).
Enjoy
--
Chris Garaffa
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.