Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting Bridge question




On Nov 15, 2007, at 4:49 AM, email@hidden wrote:

No, "current" is an iTunesTrack object. [current data] return a
compilation error. "artwork" is an iTunesArtwork object. It has no
-data method. Assuming you meant [artwork data], that would equal
[[[current artworks] objectAtIndex:0] data] which results in an
uncaught exception, even though it looks like the equivalent to the
-data method of the NSAppleScript way to me:

[[[[NSAppleScript alloc] initWithSource:@"tell application \"iTunes\"
to return data of artwork
1 of current track"]  executeAndReturnError:nil] data]

When I first started using ScriptingBridge I struggled with a similar problem (iTunes add: wants an NSArray - an array of what ? It turns out it needs an array of NSURL's).


To debug this I ran the Script Editor app 'in debug mode' with a small handwritten script to mirror my action. To do this set the AEDebugSend environment variable in a Terminal window and then launch the script editor app from the same terminal session. ScriptEditor will log to stdout a dump of the raw events it was sending to iTunes - I could see that my posix path was being converted to an 'furl' applevent and from their I deduced the NSURL requirement.

Perhaps a similar trick with the artwork might reveal what the underlying types are ? And from there the most likely matching/ appropriate Cocoa type ?

Andrew 8-)

_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Scripting Bridge question (From: email@hidden)
 >Re: Scripting Bridge question (From: email@hidden)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.