• 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: Efficient searching of Address Book
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Efficient searching of Address Book


  • Subject: Re: Efficient searching of Address Book
  • From: Graff <email@hidden>
  • Date: Wed, 11 Feb 2004 20:34:31 -0500

Give this script a try:
-------
on getNameFromEmail(theEmail)
tell application "Address Book"
repeat with aPerson in every person
if (value of email of aPerson) contains theEmail then
return name of aPerson
end if
end repeat
end tell

return ""
end getNameFromEmail
-------

- Ken

On Feb 11, 2004, at 6:47 PM, Lachlan Deck wrote:

Hi all,

I'm trying to figure out how I might make the following method far more efficient than it is. It averages about 8 seconds to look up the name of a person who has, as one of their emails, the given email address anEmail. Here's the method...

on getNameFromEmail(anEmail)
tell application "Address Book"
repeat with eachPerson in every person
set theName to name of eachPerson
repeat with eachMail in (properties of email in eachPerson) as list
if (eachMail contains {value:anEmail}) then
return theName
end if
end repeat
end repeat
end tell
return null
end getNameFromEmail

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?
Cheers...

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.
_______________________________________________
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.

References: 
 >Efficient searching of Address Book (From: Lachlan Deck <email@hidden>)

  • Prev by Date: Re: Efficient searching of Address Book
  • Next by Date: Re: Colonic irrigation (OS X)
  • Previous by thread: Re: Efficient searching of Address Book
  • Next by thread: Re: On Run handlers
  • Index(es):
    • Date
    • Thread