Re: Person from email address
Re: Person from email address
- Subject: Re: Person from email address
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 07 Oct 2004 00:45:18 -0700
On 10/6/04 10:26 PM, "Michelle Steiner" <email@hidden> wrote:
>
> On Oct 6, 2004, at 9:32 PM, Paul Berkowitz wrote:
>
>>>> tell application "Address Book"
>>>> get every person where value of every email of it contains al
>>>> end tell
>>>
>>> That returns an empty list on my machine.
>>
>> Well, it all depends what value you give to al. doesn't it?
>>
>> set al to "email@hidden"
>
> What confused me is "value... contains" so, I tried solely for
> "michelle.org" thinking it would return all the people who have one or
> more email that contains "michelle.org"
>
> So, how would I check for that?
[property] of every [anything]
is always a list. 'contains', by rights, is supposed to require the same
class on either side, so generally
[someList] contains {al}
is the correct way to do it. Unfortunately, whoever designed whose clauses
for AppleScript forgot about that, and it never works. (In this case, you
get a ridiculous Cocoa scripting result of {} instead of an error as you
should.) Fortunately, where the list is a list of strings, the coercion of
string to single-item list works even in whose clauses so
get every person where value of every email of it contains al
works fine.
What you're looking for is something completely different (looking for a
substring) that requires a repeat loop, looping through every contact,
getting 'value of every email' list for each contact, then looping through
each such list for items that contain "michelle.org" (no list braces since
now we're looking for a string containing a substring). Unless and until
Address Book decides to implement its own variety of grep which would allow
you to look for every person where value of it contains "*michelle.org". I
wouldn't hold my breath.
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden