Updating records in Address Book
Updating records in Address Book
- Subject: Updating records in Address Book
- From: Robert R.Horning <email@hidden>
- Date: Mon, 18 Feb 2008 20:25:29 -0700
I'm trying to do two things:
1) Update existing persons in the Address Book
2) Create new persons
On further testing, here's what I've learned:
This runs and adds records to the Address Book, allowing properties
of new records to be filled in:
set ABids to {}
set counter to 1
tell application "Address Book"
repeat until counter > 3
set the theCardID to make new person
set end of ABids to theCardID
set counter to counter + 1
end repeat
end tell
set theCardID to item 2 of ABids
tell application "Address Book" to set first name of theCardID to "Bob"
tell application "Address Book" to save addressbook
The following fails when I try to update an pre-existing person,
returning the message "Can't set «class azf7» of
\"F0E1BBE2-1F41-41F1-8AF9-4689222BE552:ABPerson\" to \"Bob\"."
tell application "Address Book" to set theCardID to id of person
2 -- different from item 2 of ABids, since there are pre-existing
persons
tell application "Address Book" to set first name of theCardID to "Bob"
tell application "Address Book" to save addressbook
In the first case, I'm adding a new person and filling in its
properties. In the second case, I'm accessing a pre-existing person
and trying to fill in, or change, its properties.
How do I change properties of pre-existing persons? _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden