New Adress in Address Book
New Adress in Address Book
- Subject: New Adress in Address Book
- From: email@hidden (michael.slomski)
- Date: Fri, 22 Aug 2003 21:29:13 +0200
Hello,
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?
Regards
Michael Slomski
-------------------------------------------------------------------
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: Matt Petrowsky <email@hidden>
>
Datum: Wed, 5 Mar 2003 02:42:10 -0800
>
An: AppleScript-Users <email@hidden>
>
Betreff: Address Book script contribution
>
>
Since switching to Address Book I found that my collection of contacts
>
from over the years has every possible treatment of phone number
>
formatting.
>
>
So here is a nice script that will currently format your phone numbers
>
(10 digit US) into (xxx) xxx-xxxx format.
>
>
It will leave any number shorter or longer than 10 digits alone. Modify
>
as needed and enjoy.
>
>
--- snip ---
>
>
-- Routine for cleaning a text string into a number for formatting.
>
-- Uses coercion to Real to get only numbers
>
-- and bypass any periods, slashes, or other stuff.
>
on cleanNumber(theString)
>
set rawNumber to ""
>
repeat with i from 1 to count of theString
>
set x to character i of theString
>
try
>
x as real
>
if x is not "-" then
>
set rawNumber to rawNumber & x
>
end if
>
on error errString number errNumber
>
>
end try
>
end repeat
>
-- This is where you set your formatting of the number and default to
>
the supplied text if conditions are not met.
>
if length of rawNumber is 10 then
>
set myNumber to "(" & characters 1 thru 3 of rawNumber & ") " &
>
characters 4 thru 6 of rawNumber & "-" & characters 7 thru 10 of
>
rawNumber
>
else
>
return theString
>
end if
>
end cleanNumber
>
>
-- Main script starts here
>
tell application "Address Book"
>
repeat with CurrentPerson in people
>
repeat with thePhone in phones of CurrentPerson
>
set value of thePhone to my cleanNumber(value of thePhone)
>
end repeat
>
end repeat
>
end tell
>
>
Matt Petrowsky
>
_______________________________________________
>
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.
_______________________________________________
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.