In article <6A1A83D5-D729-11D8-9B86-000A95BD9874@xxxxxxxxxxxxx>,
ken@xxxxxxxxxxxxx (Ken Williams) wrote:
> Hi Chris,
>
> This is all working great. I just realized, though, that my initial
> email search isn't working - to find a person with the email $foo, I've
> tried:
>
> $person = $glue->obj(people => whose(email => equals => $foo));
>
> Obviously this can't work, because email is an element, not a property.
> Is there a way to do this in a single query, or do I need to iterate
> through some result list?
I can't see a way. If someone can tell me how to do it in AppleScript, I
can convert it to Mac::Glue. But I can't see how to do it in AppleScript
either.
push @found, $person if grep /aol/i, @emails;
FWIW, here is what I would do to iterate:
#!/usr/local/bin/perl
use strict;
use warnings;
use Mac::Glue ':all';
my $glue = new Mac::Glue 'Address Book';
my @found;
my @people = $glue->obj('people')->get;
for my $person (@people) {
my @emails = $person->prop(value => 'emails')->get;
push @found, $person if grep /aol/i, @emails;
}
--
Chris Nandor pudge@xxxxxxxxx http://pudge.net/
Open Source Development Network pudge@xxxxxxxx http://osdn.com/
|