2

I'm trying to use applescript to clean up various problems a large address book, to large to fix by hand. I've been able to find and observe contacts and groups in AppleScript successfully. However, any sort of modifications I make to any property of a contact do not persist, even after calling Application save. For instance, this script to change the first name of my first contact:

tell application "Contacts"
set thePerson to (item 1 of people)
log (get name of thePerson)
set first name of thePerson to "JustTesting"
if unsaved then
    log "unsaved"
else
    log "not unsaved"
end if
save
log (get first name of thePerson)
return thePerson
end tell

This script doesn't work - it does not modify my first contact, and also logs "not unsaved".

I am using 10.8.3 Mountain Lion. What am I doing wrong here?

(I've asked a similar question on SO here: https://stackoverflow.com/questions/17140148/how-to-modify-an-abperson-instance-using-pyobjc , on how to do this with PyObjC)

1
  • Works for me. 10.8.4
    – markhunte
    Jun 17 '13 at 19:22
1

Answering my own question. Looking at errors in the console after running the above script, I saw many errors looking like:

AOSKit ERROR: (-) RAF: Invalid url -- https://[myemail]@webdav.facebook.com/[myfbid]/contacts/

(email and id changed of course). I have a 'Facebook' account set up in OS X preferences. By an educated guess, I deleted this Facebook OS X account, and then re-added it. After that, the above script works correctly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .