Re: New Adress in Address Book
Re: New Adress in Address Book
- Subject: Re: New Adress in Address Book
- From: email@hidden (michael.slomski)
- Date: Fri, 22 Aug 2003 22:48:06 +0200
Hi Paul
Thank you very much. In the mean time I wasn't lazy an I've got the
following also work:
tell application "Address Book"
set anewPerson to (make new person with properties {last name:"Slomski",
first name:"Michael", organization:"Computerkartographie", birth date:(date
"Dienstag, 2. Juli 1968 12:00:00 Uhr")})
make new phone at end of anewPerson with properties {label:"Privat",
value:"11"}
End tell
I'm shure, your code ist more stable, but who knowes haw AS is really
working :-)
The hint with "save addressbook" is a very nice. Before I have to switch
groups so that the new address shows up. Now it shows up immediately.
Michael
-------------------------------------------------------------------
Computerkartographie M. Slomski
Kartographie Systemberatung & Betreuung
f|r Apple Macintosh
Schnorr-von-Carolsfeld-Str. 19
D-81927 M|nchen
Tel.: ++49 +89-929 40 57 oder ++49 +177-44 57 990
Fax.: ++49 +89-939 311 71
Email: email@hidden
>
Von: Paul Berkowitz <email@hidden>
>
Datum: Fri, 22 Aug 2003 13:21:46 -0700
>
An: AppleScript-Users <email@hidden>
>
Cc: "michael.slomski" <email@hidden>
>
Betreff: Re: New Adress in Address Book
>
>
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.