• 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: Scripting Bridge question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting Bridge question


  • Subject: Re: Scripting Bridge question
  • From: email@hidden
  • Date: Thu, 15 Nov 2007 19:40:00 +0100

Thanks, got that already. The code would hardly compile elsewise ;-)

On Nov 15, 2007 6:50 PM, Jason Ketterman <email@hidden> wrote:
> The sdef utility gives a header file with all the properties of each item. I
> don't know if that's what you're missing.
>
>
> // a piece of art within a track
> @interface iTunesArtwork : iTunesItem
>
> @property (copy) NSImage *data;  // data for this artwork, in the form of a
> picture
> @property (readonly) BOOL downloaded;  // was this artwork downloaded by
> iTunes?
> @property (copy, readonly) NSNumber *format;  // the data format for this
> piece of artwork
> @property NSInteger kind;  // kind or purpose of this piece of artwork
>
> @end
> You get the header file by running:
> sdef /Applications/iTunes.app | sdp -fh --basename iTunes
>
> Maybe I'm just repeating stuff that everyone knows, just thought I'd share
> this though.
> Jason
>
>
>
> On Nov 15, 2007, at 10:39 AM, email@hidden wrote:
>
>
> Thanks for the tip. I tried it, but to my best understanding it didn't
> reveal any secrets. What I could see was that the call returns a PICT
> image with data, but that much I knew already. What bugs me is that
> both the NSAppleScript and the ScriptingBridge approach are supposed
> to return the exact same results, yet
>
>  [[[[NSAppleScript alloc] initWithSource:@"tell application \"iTunes\"
>  to return data of artwork 1 of current track"]
> executeAndReturnError:nil] data]
>
> works, but [artwork data] doesn't... Oh well, I'll keep trying.
>
> On Nov 15, 2007 4:37 PM, Andrew Kimpton <email@hidden> wrote:
>
> 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:
>
> 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

References: 
 >Scripting Bridge question (From: email@hidden)
 >Re: Scripting Bridge question (From: email@hidden)
 >Re: Scripting Bridge question (From: Andrew Kimpton <email@hidden>)
 >Re: Scripting Bridge question (From: email@hidden)
 >Re: Scripting Bridge question (From: Jason Ketterman <email@hidden>)

  • Prev by Date: Re: Any examples of how to implement an inspector window?
  • Next by Date: Re: How to get x-coordinate?
  • Previous by thread: Re: Scripting Bridge question
  • Next by thread: Re: Scripting Bridge question
  • Index(es):
    • Date
    • Thread