Benches Uncategorized

2

copying address book entries

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

what is the most efficient way to copy all (or most) of contact info of one person to another in Address book using applescript?

For example, to copy the address I tried

tell application "address book"
set address of person "X" to address of person "Y"
end tell

this runs with no errors but produces no result. same with phones. i can go through each individual address field but it's a major pain. is there a quicker way?

2 replies

Sign in or join Beachball Help to reply.

  1. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Hi VK,

    Each person can have multiple addresses. Therefore 'addresses' of a person returns a list. Also you need to add the address data to the end of the list of addresses of the recipient card.

    The following works for me (it's not particularly fast though):

    ----
    tell application "Address Book"
    set theAddress to (properties of (address 1 of person "X"))
    make new address at the end of addresses of person "Y" with properties {label:label of theAddress, street:street of theAddress, city:city of theAddress, state:state of theAddress, zip:zip of theAddress, country:country of theAddress, country code:country code of theAddress}
    save addressbook
    end tell
    ----

    Best wishes

    John M

  2. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    thatnks. that works. I was hoping it would be possible to copy addresses directly but this is probably the best one can do.