Re: Scripting Address Book
Re: Scripting Address Book
- Subject: Re: Scripting Address Book
- From: Paul Berkowitz <email@hidden>
- Date: Mon, 03 Feb 2003 20:36:39 -0800
On 2/3/03 8:05 PM, "Lorin Rivers" <email@hidden> wrote:
>
How do I get the currently selected person/people in the 10.2.3 Address
>
Book?
You can't. You can only get them by name or by filtering on some property or
properties.
>
>
I want to select some people, and do something with their names and
>
email addresses.
Can you filter them by whose clauses? if not, you'd better go back to
Entourage, Lorin. For example, if you tried using iSync to .Mac Address Book
and discovered that email addresses with "other" label don't display on Mac
(iSync knows they're still there, BTW, and will sync them back to any
computer with all email addresses, including "other" ones, but they don't
display on .Mac), you can
tell application "Address Book"
get name of every person where (label of every email) contains "other"
end tell
that works in an instant, quite amazing. - got 98 names here in one second
from a database of 350 contacts. (Strangely, the correct syntax:
get name of every person where (label of every email) contains {"other"}
gets an empty list.)
Or even
tell application "Address Book"
set otherPeople to (every person where (label of every email) contains
"other")
repeat with i from 1 to (count otherPeople )
set otherPerson to item i of otherPeople
tell otherPerson to set label of every email whose label is "other"
to "work"
end repeat
end tell
(Maybe you can even get a "double-whammy" whose clause to work:
set label of (every email whose label is "other") of (every person where
(label of every email) contains "other") to "work"
but I don't feel like trying that one out just at the moment.
--
Paul Berkowitz
_______________________________________________
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.