On Mar 10, 2008, at 8:47 PM, has wrote:
Adam P Jenkins wrote:
Anyone know how to get the index of the current iTunes track using
Scripting Bridge?
You'll have to muck about with raw AE codes if you want to do it
with Scripting Bridge; see past discussions of SB's design flaws for
more info.
Actually it's doable in scripting bridge, without any codes. [...]
Instead of calling indexOfObjects:, try something like:
int index = -1;
int i;
for (i = 0; i < [currentTracks count]; i++) {
if ([[currentTracks objectAtIndex:i] id] == [currentTrack
id]) {
index = i + 1;
break;
}
}
// now index is either the index of the track, or -1
Bah, philistine. Try this sort of thing on a 100,000 item playlist
when track 99,999 is playing. Don't worry, I'll wait...
:-)
I wasn't really recommending this, just answering the OP's question.
I'm not sure why I'd want to know an item's numerical position in the
current playlist anyway. It seems like generally a bad idea to hold
onto this index, since it could end up pointing to a different song if
the playlist changes in any way.
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]