Re: Efficient searching of Address Book
Re: Efficient searching of Address Book
- Subject: Re: Efficient searching of Address Book
- From: Lachlan Deck <email@hidden>
- Date: Thu, 12 Feb 2004 13:03:26 +1100
Hi Paul,
On Thursday, February 12, 2004, at 12:16 PM, Paul Berkowitz wrote:
On 2/11/04 3:47 PM, "Lachlan Deck" <email@hidden> wrote:
I've tried fiddling with statements such as the following - but they
get a runtime error.
set thePersons to every person whose email contact info contains
{value:anEmail}
Any ideas?
-- (P.S, Strictly speaking, it ought to be 'contains {anEmail}', but
that
gives the wrong answer of {},
Yes, that's what I was getting with some of my attempts...
whereas 'contains anEmail' gives the right
answer. If you don't want the list brackets around the name(s) then do
this:
on getNameFromEmail(anEmail)
tell application "Address Book"
try
set theName to name of first person ,
whose value of every email contains anEmail
on error
set theName to null
end try
end tell
return theName
end getNameFromEmail
--
Paul Berkowitz
thanks muchly! That's exactly what I was after - and far more efficient
(1 second) than iterating through the list (8 seconds)! I just couldn't
figure out the grammar necessary - I'd tried all sorts of combinations.
It seems simple now that I see it ;-)
with regards,
--
Lachlan Deck
email@hidden
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.