Re: No track index in iTunes SB?
Re: No track index in iTunes SB?
- Subject: Re: No track index in iTunes SB?
- From: Jean-Daniel Dupas <email@hidden>
- Date: Mon, 10 Mar 2008 15:49:55 +0100
Le 10 mars 08 à 15:17, email@hidden 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@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
_______________________________________________
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