Re: Get List of Contact Names and Associated EMails for EMail Addresses that contain a string
Re: Get List of Contact Names and Associated EMails for EMail Addresses that contain a string
- Subject: Re: Get List of Contact Names and Associated EMails for EMail Addresses that contain a string
- From: Axel Luttgens <email@hidden>
- Date: Sat, 22 Jul 2017 05:27:14 +0200
- Ironport-phdr: 9a23:aSTJ7RVuVWy+KRF3ix2UKL67PUXV8LGtZVwlr6E/grcLSJyIuqrYbBaOt8tkgFKBZ4jH8fUM07OQ6PGwHzRYqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjSwbLdxIRmssQndqtQdjJd/JKo21hbHuGZDdf5MxWNvK1KTnhL86dm18ZV+7SleuO8v+tBZX6nicKs2UbJXDDI9M2Ao/8LrrgXMTRGO5nQHTGoblAdDDhXf4xH7WpfxtTb6tvZ41SKHM8D6Uaw4VDK/5KptVRTmijoINyQh/W7LhcN+kaJVrxCvqRxlzIDaY4+VOuR5cK7GYdMaXG9BUtpRVyBdAo6xaZYEAeobPeZfqonwv0cDrBSgCgmoGejhzCJIhmPq3a01zeshFxrG1xEnEt0Uv3XbstH1OL0WUeCo0KnI0TrDYO1Q2Tfm84XIaRMhoPGKXb1ubcrd01IgGB3cg1iWtIfrPCuV2/wJvmSG9eZsSOGih3I9pw1vvDSj3NkghpfNi48T11vK7z92wJwvKt29UEN7ZNmkH4ZOuCyCLIt2R98iQ3lvuCYn1r0KoZ67czYOyJQg3xPfbOGHc5ST4hLiTOaRJTB4hG9/dL2hiBe9602gyvX4VsaqylpFsi1FktzUunAM0Rzc9NSHR+N580u8wzqDygPe5v1eLUwqi6bXMYAtzqA0m5YLtETMBC72mEH4jK+McUUk//Cl5P7oY7r4op+QLYt0ihziMqQylcywH+I4MhMVUmiA+uS91Lvj8lPlQLlQlfI5jLHVsIrGKsQDuq65HwhV35455BanFzem1MoXnWIbI1JfeRKHl5TpN0jTIPDjE/i/mU+snSxvx/DHJb3hHo7NImLZn7f5ZbZ971BTxBAvwtBY4pIHQo0GdfvoRwelvcTAChIiOBa12/qiFc5wzJg2XWOUHrTfObvKtVLO7eUqdbq2aZcRqQr6fvE++ra6hGchnVIGdrOoxYdSdWu1BO9OJ0SCfWGqi88ZFWpMtQ07Gr/EklqHBBdDanL6e78g+j42DpnuWY7TS4TrhKGdwCi2GIZ+fWNXDF2QV33lIdbXE8wQYT6fd5cy2gcPUqKsHtcs
> Le 22 juil. 2017 à 01:30, Jim Underwood a écrit :
>
> Axel,
>
> Thanks for the script. Always good to see another approach.
>
> Unfortunately, this script seems to produce a duplicate list item if the
> person has more than one email:
>
> […]
Damn, you are right.
While reasoning, I focused on the existence on the various values I was working
with, but then miserably overlooked the duplicate cases…
So, let’s add even more inefficiency:
on fetch_contact_names_and_emails_for_domain(_domain)
local _list, _email, _email_id, _person, _person_ids
set _list to {}
set _person_ids to {}
tell application "Contacts"
repeat with _email in (emails of people whose value ends with
_domain)
set _email_id to id of _email
set _person to item 1 of (people whose id of emails
contains _email_id)
if id of _person is not in _person_ids then
copy id of _person to the end of _person_ids
copy {_person's first name & " " & _person's
last name, value of (emails of _person whose (value ends with _domain))} to the
end of _list
end if
end repeat
end tell
return _list
end fetch_contact_names_and_emails_for_domain
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden