Re: Trying to get my head around an NSGenericException/Apple Event error
Re: Trying to get my head around an NSGenericException/Apple Event error
- Subject: Re: Trying to get my head around an NSGenericException/Apple Event error
- From: email@hidden
- Date: Sun, 23 Dec 2007 13:57:37 +0100
Thank you very much. That is just the information I was looking for.
You are probably right about the object specifier being the problem. I
was informed by one user he only had one source and one library
playlist, but I think he might have been wrong.
Happy holidays.
On Dec 23, 2007 2:12 AM, Fritz Anderson <email@hidden> wrote:
> On 22 Dec 2007, at 8:41 AM, email@hidden wrote:
>
> > A typical exception looks like this: Apple event returned an error.
> > Event =
> > 'hook'\'Srch'{ '----':'obj '{ 'want':'cLiP', 'from':'obj
> > '{ 'want':'cSrc',
> > 'from':'null'(), 'form':'indx', 'seld':1 }, 'form':'indx', 'seld':1 },
> > 'pTrm':'utxt'("Beck"), 'pAre':'kSrR' }
> >
> > (That 'from':'null'() thing looks a little suspicious...)
>
> The null container in the Apple Event object model is the application
> itself.
>
> '----':'obj ' # Direct object is an object(1) such that...
> { 'want':'cLiP', 'from':'obj ' # (1)'s a library playlist from an
> object(2) such that
> { 'want':'cSrc', 'from':'null'(), # (2) is a source from the
> application
> 'form':'indx', 'seld':1 }, # at index 1
> 'form':'indx', 'seld':1 }, # and the library playlist is at
> index 1 in the source
> # In other words "library playlist 1 in source 1"
> 'pTrm':'utxt'("Beck"), # Parameter 2: Search term "Beck"
> 'pAre':'kSrR' # Parameter 3: artists, you say?
>
> Indices in Apple Events and AppleScript are 1-based.
>
> The only question that is obvious is whether there is at least one
> source, and whether that first source has at least one library playlist.
>
> > The code that throws this exception is:
> >
> > track_array = (SBElementArray *)[libraryPlaylist searchFor:theArtist
> > only :
> > 'kSrR']; //only artists
> >
> > (...where libraryPlaylist = [[[[[iTunes sources ] objectAtIndex:0]
> > libraryPlaylists] objectAtIndex:0] retain] )
> >
> > Similar exceptions are thrown for other operations as well, for
> > example when
> > retrieving user playlists, so it's not just the search part causing
> > problems.
> >
> > Any ideas? Could the problem be these users have multiple sources/
> > library
> > playlists in iTunes? If so, how do I find the main source/library
> > playlist
> > without explicitly asking the user for it?
>
> That's a question of how, specifically, to script iTunes. I can't help
> you with that. You might experiment with iTunes and AppleScript
> yourself, to see if you can get them to violate your assumption that
> there is a "library playlist 1 in source 1." You might then acquire a
> definition of what a "main" playlist is, and what it might look like.
> You might then be in a position to intelligently ask users
> experiencing this problem what their source/playlist structure is.
>
> Or I may be wrong that the object specifier is the problem. It's what
> I'd investigate, though.
>
> The applescript-users list might be able to offer strategies for
> scripting iTunes.
>
> — F
>
>
_______________________________________________
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