Re: Address Book: add element to existing record
Re: Address Book: add element to existing record
- Subject: Re: Address Book: add element to existing record
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 23 Oct 2003 09:56:35 -0700
On 10/23/03 8:52 AM, "Matthew Galaher" <email@hidden> wrote:
>
Folks, thanks for you help last week. My script is all done except the
>
last function that actually adds an email address if the person is
>
found to already exist in the Address book.
>
>
Where I'm having problems is I don't understand how to add an element
>
to a person that exists. I can get the id, but I seems to be missing
>
something. TIA
>
>
--snip This does not work. Whats wrong?
>
set listOfOnePerson to people whose first name is firstName_toAdd and
>
last name is lastName_toAdd
>
repeat with aPerson in listOfOnePerson
>
tell aPerson
>
make new email at end of emails with properties {label:"home",
>
value:emailAddress_toAdd}
>
end tell
>
save addressbook
>
end repeat
>
--end snip
There's nothing wrong with your method of making a new email. Are you
positive you have the variables for first and last name set correctly?
What do you get just with your first line:
set listOfOnePerson to people whose first name is firstName_toAdd and
last name is lastName_toAdd
Do you get a list of one person, or do you get an empty list {} ?
It's also worth checking what happens if you use the better type of repeat
loop:
repeat with i from one to (count listOfOnePerson)
set a Person to item i of listOfOnePerson
tell aPerson
etc.
(Although I would have thought that just getting 'item 1' would be good
enough. Or getting 'first person whose' in a try block.)
--
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.