Re: Scripting Bridge && filteredArrayUsingPredicate
Re: Scripting Bridge && filteredArrayUsingPredicate
- Subject: Re: Scripting Bridge && filteredArrayUsingPredicate
- From: email@hidden
- Date: Wed, 2 Jan 2008 17:58:37 +0100
On Jan 2, 2008 2:40 PM, has <email@hidden> wrote:
> On 29 Dec 2007, at 16:28, email@hidden wrote:
>
> > On a similar note, I recently stumbled upon what appears to be another
> > major flaw in filteredArrayUsingPredicate:. If the predicate is set to
> > match an empty string "" (a common enough operation when dealing with
> > meta tags, for example in iTunes), filteredArrayUsingPredicate: always
> > returns an empty array, regardless if the objects in the unfiltered
> > array matches the predicate or not.
>
> Seems to work here. One reason you might not get matches is if you're
> using an empty string where some other value is expected (integer,
> 'missing value' constant, etc).
Really? How did you accomplish that? I'd love to see a working
example. The snippet below does not return a match no matter how I
format the predicate. track_array contains an object whose album is a
verified empty string (""):
theAlbum = @"";
predicate = [NSPredicate predicateWithFormat:@"album like[cd] %@", theAlbum];
track_array = (SBElementArray *)[track_array
filteredArrayUsingPredicate:predicate];
> Deleting elements should be done via the application's 'delete'
> command. For whatever reasons, the familiar -[NSMutableArray
> removeObject...] methods aren't mapped to Apple events.
Thanks, that works. Hopefully I won't have to deal with these case
manually, though, if what you say above is correct.
> Google around if you
> want to read some of my other rants on the subject.
I did, very interesting. Thanks.
> Anyway, my advice FWIW would be: 1. learn how Apple event IPC really
> works, and 2. use appscript to do it.
Cool. I hadn't heard about appscript before. I'll play around with it
later and see how it compares.
> Yes, there's a bit more of a
> learning curve with this approach, since appscript approaches Apple
> event IPC on its own terms and doesn't try to sweep its complexities
> and warts under the rug and pretend they don't exist. But that's the
> nature of the AppleScript beast, and if you want to work with it
> effectively then it's something you just gotta deal with.
>
>
> HTH
>
> has
> --
> http://appscript.sourceforge.net
> http://rb-appscript.rubyforge.org
>
>
_______________________________________________
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