• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: No track index in iTunes SB?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: No track index in iTunes SB?


  • Subject: Re: No track index in iTunes SB?
  • From: Adam P Jenkins <email@hidden>
  • Date: Mon, 10 Mar 2008 23:16:20 -0400


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 (email@hidden)

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:
This email sent to email@hidden


References: 
 >Re: No track index in iTunes SB? (From: has <email@hidden>)

  • Prev by Date: Re: NSURLDownload and userInfo
  • Next by Date: Re: How to run progress bar in a separate thread
  • Previous by thread: Re: No track index in iTunes SB?
  • Next by thread: [iPhone] UIImage drawInRect not scaling image
  • Index(es):
    • Date
    • Thread