Can applescript work with the Contacts app?

The following code does not work:


Tell application “Contacts”

Set thePerson to the first person whose (first name is “Frank” and last name is “Holden”

Tell thePerson


Set oldNote to the note

Set the note to “testing”


End tell

End tell

Mac mini 2018 or later

Posted on Feb 25, 2023 6:25 AM

Reply
3 replies

Feb 25, 2023 7:51 AM in response to Frank Holden

Thank you for the reply. the following code results in the error message: Can’t set «class az37» of «class azf4» to "testing 2".


I have a contact Test Person


=====

property fName : "Test"

property lName : "Person"


tell application "Contacts"

try

set thePerson to the first person whose (first name is fName and last name is lName)

set theName to the (name of thePerson as text)

set theNote to the note of thePerson as text

display dialog theName & return & return & theNote --> results in "Test Person: testing 1"

set the note of the person to "testing 2" as text

save

on error theError

display dialog theError

end try

end tell

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Can applescript work with the Contacts app?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.