On 11/3/00 7:06 AM, "Allen Watson" <[EMAIL PROTECTED]> wrote:
> I've been trying to enhance my script to find duplicate contacts to create a
> version that will locate all contacts, assign them a special category, and
> then finish with that set of contacts "found" in the Address Book. I have
> all but the last step working.
>
> Does anyone (Paul, Dan) know a way to script finding contacts by category? I
> want to do the equivalent of:
>
> Set dupes to every contact whose category is "Possible Duplicate"
Yup! that was in my first (or maybe second) "report on Entourage scripting"
which you said you were going to keep and refer to! As you've just
discovered for yourself, Dan never implemented whose clauses for category
property of contact (bug). You have to do it by a repeat loop:
tell application "Microsoft Entourage"
set theContacts to every contact
set catContacts to {}
set catName to "Possible Duplicate"
set n to (count theContacts)
repeat with i from 1 to n
set theContact to item i of theContacts
set nCategories to get theContact's category
if nCategories contains {category catName} then set end of
catContacts to theContact
end repeat
catContacts
end tell
>
<snip>
> Is there a way to script what I want?
>
> Ending with the desired category <selected> would be okay. Ending with a
> kind of custom view showing <only that category> would be best.
>
> Any help appreciated.
You can't script properties for a new custom view, so that's out.
open address book 1
set selection to catContacts
will give you those contacts selected in the Address Book if that's maybe
what you're looking for?
You can do a custom view without a script of course. Just make a new custom
view setting the Item types to <Contacts> and setting the criteria to
<Category> is "Possible Dupes>.
If you first just make a Category "Possible Dupes", and make a "Contacts in
the Possible Dupes Category" as above, even with no one in it, all you have
to do is
open custom view "Possible Dupes"
and it will open with the contacts on view as most recently set by your
script.
Does this help?
--
Paul Berkowitz
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
To search the archives:
<http://www.mail-archive.com/entourage-talk%40lists.boingo.com/>