I've been using AppleScript to create new people in the Address Book/Contacts app on my Mac running macOS Monterey 12.6. I've been storing their IDs (e.g. 778C4D8D-0A22-4918-A5B6-73361FFF8779
) and I now need to create a version of the AppleScript that will perform an update of the Contacts app record using their Contacts app ID as the identifier for which person to update.
Here's my AppleScript for creating a new person:
tell application "Contacts"
set thePerson to make new person with properties ¬
{first name:"Dee", last name:"Velhopa", organization:"Paws On Error"} ¬
make new email at end of emails of thePerson with properties ¬
{label:"Work", value:"[email protected]"}
make new phone at end of phones of thePerson with properties ¬
{label:"Work", value:"+44 0161 715 7028"}
make new url at end of urls of thePerson with properties ¬
{label:"Work", value:"http://www.pauseonerror.com/"}
make new address at end of addresses of thePerson with properties ¬
{label:"Work", street:"MellowBank", city:"Bored End", state:"Bucks", zip:"SL8 5AJ", country:"U.K."} ¬
save
end tell
I haven't been able to work out how to modify this so that if I have their ID to simply do an update with the same data but not create a new person.