• 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: email@hidden
  • Date: Mon, 10 Mar 2008 15:17:10 +0100

Followup... I tried two workarounds, both however return an incorrect result:

// Try #1
iTunesPlaylist *currentPlaylist = [ iTunes currentPlaylist ] ;
SBElementArray *currentTracks = [currentPlaylist tracks];
int index = [currentTracks indexOfObject:[iTunes currentTrack] + 1];
NSLog(@"%d", index) // Returns 376275776! Should be 1...

// Try #2
NSAppleScript *the_script=[[NSAppleScript alloc] initWithSource:@"tell
application \"iTunes\" to return index of current track"];
int index = (int)[the_script executeAndReturnError:nil];
[the_script release];
NSLog(@"%d", index); // Also returns 376275776 :-/

Surely there has to be an easy way to do this?


On Mon, Mar 10, 2008 at 12:56 PM,  <email@hidden> wrote:
> Anyone know how to get the index of the current iTunes track using
>  Scripting Bridge? With Applescript, it's as simple as "tell iTunes to
>  return index of current track", but iTunes SB has no such property
>  (well, there is one, but it only refers to the index of the current
>  playlist). It seems the iTunesTrack index property is simply
>  missing...? Or am I missing something?
>
_______________________________________________

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

  • Follow-Ups:
    • Re: No track index in iTunes SB?
      • From: Jean-Daniel Dupas <email@hidden>
References: 
 >No track index in iTunes SB? (From: email@hidden)

  • Prev by Date: Re: Google Map embedded in an iPhone application
  • Next by Date: Re: No track index in iTunes SB?
  • Previous by thread: No track index in iTunes SB?
  • Next by thread: Re: No track index in iTunes SB?
  • Index(es):
    • Date
    • Thread