Re: Creating Entourage contacts (revisited)
Re: Creating Entourage contacts (revisited)
- Subject: Re: Creating Entourage contacts (revisited)
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 21 Jun 2001 15:10:35 -0700
On 6/21/01 10:17 AM, "Jolly Roger" <email@hidden> wrote:
>
Guys, I am not getting this. I've been at it 30 minutes, and still
nothing.
>
Can you tell what I am doing wrong here?
>
>
-- begin script
>
tell application "Microsoft Entourage"
>
set newContact to make new contact with properties {first name:"First",
>
last name:"Last", description:"added via AppleScript."}
>
set newContact's email addresses to {contents:"email@hidden"} --
>
this won't work =(
>
--set newContact's default email address to (newContact's email address
>
1) -- this won't work either =(
>
>
set {a, b, c} to {last name, first name, name} of newContact
>
try
>
set d to contents of email address 1 of newContact
>
on error
>
set d to "no email address =("
>
end try
>
open newContact
>
{a, b, c, d}
>
end tell
>
-- end script
>
>
This doesn't fail to compile, but results in no email address being added
to
>
the contact. I'd love to be able to add the email address on the same
line
>
as the "make new contact" but have not been able to do it, so I was going
to
>
settle for adding it afterwards; but I can get neither one to work.
>
JR, you're scripting email addresses as if they were properties contacts,,
but they're not: they're elements. Nevertheless, through a very clever
implementation, you _can_ script one email address _at the moment of
creation of the contact only_ as if it were a property.
So , what should always work is:
set newContact to make new contact with properties {first name:"First",
last name:"Last", description:"added via AppleScript."}
make new email address at newContact with properties
{contents:"email@hidden"}
And you can go on adding other email addresses to this contact in the same
way ad infinitum if you wish.
But you can also choose to do this:
set newContact to make new contact with properties {first name:"First",
last name:"Last", description:"added via AppleScript.", email
address:{contents:"email@hidden"}}
as the easy way.
--
Paul Berkowitz