Right, thanks. That was a typo in Mail. Still doesn't do the trick though. However, I found it does if I do a "get" on the [currentPlaylist tracks] and [iTunes currentTrack]. But this seems to cause a memory leak, so I'm not sure it's the right way to go.
On Mon, Mar 10, 2008 at 3:49 PM, Jean-Daniel Dupas <[EMAIL PROTECTED]> wrote: > > Le 10 mars 08 à 15:17, [EMAIL PROTECTED] a écrit : > > > > 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... > > > > int index = [currentTracks indexOfObject:[iTunes currentTrack] + 1]; > should be > > int index = [currentTracks indexOfObject:[iTunes currentTrack] ] + 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 PROTECTED]> 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 protected]) > > > > 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/devlists%40shadowlab.org > > > > This email sent to [EMAIL PROTECTED] > > > > _______________________________________________ Cocoa-dev mailing list ([email protected]) 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]
