Re: New Adress in Address Book
Re: New Adress in Address Book
- Subject: Re: New Adress in Address Book
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 22 Aug 2003 13:21:46 -0700
On 8/22/03 12:29 PM, "michael.slomski" <email@hidden> wrote:
>
Does anyone know how to add an adress to the address book?
>
I've started with a very basic script:
>
>
tell application "Address Book"
>
make new person at end of last group with properties {last name:"ghj",,
>
first name:"test", birth date:(date "Dienstag, 2. Juli 1968 12:00:00 Uhr")}
>
end tell
>
>
This will create a new entry. Fine, but how can I add the other information
>
like phones, street etc?
>
>
I can read this info with:
>
get value of phone 1 of first person
>
>
But how can I set this info at the above make statement?
It depends on whether the Dictionary says it is a _property_ of person (like
your 'last name', 'first name', birth date'), or an _element_ of person
(like phones, addresses, IM Handles, etc.) Basically, an element is
generally something you can have more than one of.
Elements cannot be included ion the 'with properties' parameter of 'make
new', since they're not properties. You had to make them 'at' the person (or
other object) you've just created. Especially to make more than one, you'll
need to set a variable to the (result of) your 'make new' command above.
(BTW, you don't have to make a person at the end of a group - you can just
make the person, and 'add' it to the group later if desired.)
tell application "Address Book"
set newPerson to make new person with properties {last name:"ghj", first
name:"test", birth date:(date "02.08.1968")}
tell newPerson
make new phone at end of phones with properties {label:"home",
value:"+44 207 793 1234"}
end tell
save addressbook
end tell
(You can 'make new phone at end of phones of newPerson' but the 'tell'
format is much handier and more legible, especially if you're making several
elements.)
Each new element needs its own 'make' line. Use your localized (German)
term for the standard labels (such as "home" in English).
--
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.