• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Updating records in Address Book
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Updating records in Address Book
      • From: Neil Faiman <email@hidden>
    • Re: Updating records in Address Book
      • From: Michelle Steiner <email@hidden>
  • Prev by Date: Re: Spotlight comments - command line?
  • Next by Date: Re: Updating records in Address Book
  • Previous by thread: Updating records in Address Book
  • Next by thread: Re: Updating records in Address Book
  • Index(es):
    • Date
    • Thread