Thank you!

On Mon, Mar 10, 2008 at 8:04 PM, Christopher Nebel <[EMAIL PROTECTED]> wrote:
>
> On Mar 10, 2008, at 4:56 AM, [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?
>
>  What's missing is the line in iTunes' dictionary that says that tracks
>  have an "index" property in the first place.  Scripting Bridge takes
>  the dictionary at its word, and therefore, no -[iTunesTrack index]
>  accessor.  Ultimately, it's an iTunes bug.  In the meantime, you can
>  work around the problem by using the raw codes [1]:
>
>         int index = [[[[iTunes currentTrack] propertyWithCode:'pidx'] get]
>  intValue];
>
>  Ordinarily, Scripting Bridge would take care of the -get and -intValue
>  for you, since this is an attribute you're dealing with [2], but if
>  you're dropping down to the base level, you have to be explicit.
>
>
>  --Chris Nebel
>  AppleScript Engineering
>
>  [1]  You can find the raw code by inspecting the dictionary.  For spot
>  queries like this, I find it easiest to use Terminal:
>
>         % sdef /Applications/iTunes.app | xmllint --format - | grep
>  'name="index"'
>             <property name="index" code="pidx" type="integer" access="r"
>  description="the index of the playlist in internal application order"/>
>
>  [2]  This is covered in the documentation under "Lazy Evaluation":
>  when you use an accessor that returns an attribute (in other words,
>  anything that isn't an SBObject descendant or SBElementArray),
>  Scripting Bridge will automatically do a -get and unbox the value for
>  you.
>
_______________________________________________

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]

Reply via email to