Re: New Adress in Address Book
Re: New Adress in Address Book
- Subject: Re: New Adress in Address Book
- From: Steve Roy <email@hidden>
- Date: Fri, 22 Aug 2003 16:58:25 -0400
michael.slomski <email@hidden> wrote:
>
Does anyone know how to add an adress to the address book?
Here's the jist of how Address Book Importer creates a complete record. Notice
the workaround for the address bug.
tell application "Address Book"
set thePerson to make new person at end with properties {first name: ...,
last name:..., job title:..., organization: ..., home page:...}
tell thePerson
set birth date to ...
set note to ...
-- For the address, there's a bug in Address Book where the
-- address isn't set if you pass 'missing value' for one of
-- the fields, so you're better off setting each field
-- separately like this
set theAddress to make new address at end of addresses with properties
{label:..., street:""}
if aStreet is not missing value then set street of theAddress to aStreet
if aCity is not missing value then set city of theAddress to aCity
if aState is not missing value then set state of theAddress to aState
if aZIP is not missing value then set zip of theAddress to aZIP
if aCountry is not missing value then set country of theAddress to
aCountry
make new phone at end of phones with properties {label:..., value:...}
make new email at end of emails with properties {label:..., value:...}
make new AIM Handle at end of AIM handles with properties {label:...,
value:...}
end tell
end tell
Steve
--
Steve Roy <email@hidden>
Personal homepage: <
http://homepage.mac.com/sroy>
Projects homepage: <
http://www.roydesign.net>
_______________________________________________
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.