tell application "Contacts"
set theJasons to people whose name begins with "Jason"
log "#Jasons = " & (count of theJasons)
set somePerson to item 1 of theJasons
log "class of somePerson = " & class of somePerson
set SomePersonsID to the id of somePerson
log "id of somePerson = " & SomePersonsID
log "groups of somePerson = "
log groups of somePerson as list
log "name of groups of somePerson = "
log name of groups of somePerson as list
set theKnownGroup to the group "Known"
log "# in theKnownGroup = " & (count (theKnownGroup))
log "class of theKnownGroup = " & class of theKnownGroup
set theKnownGroupsID to id of theKnownGroup
log "id of theKnownGroup = " & theKnownGroupsID
-- All of these got the same error message:
-- add somePerson to group id theKnownGroupsID
-- add person id SomePersonsID to group id theKnownGroupsID
add somePerson to theKnownGroup
-- add person id SomePersonsID to theKnownGroup
end tell
-->
(*#Jasons = 4*)
(*class of somePerson = person*)
(*id of somePerson = 142EF1DB-DDDB-45A3-A1B0-936358820D84:ABPerson*)
(*groups of somePerson = *)
(*group id 439805FD-3684-408F-85F9-5AB9A9A7706D:ABGroup*)
(*name of groups of somePerson = *)
(*card*)
(*# in theKnownGroup = 1*)
(*class of theKnownGroup = group*)
(*id of theKnownGroup = 32E8FDCB-2D91-4DA8-9A35-095A33F6EACD:ABGroup*)
Result:
error "Contacts got an error: You can only add a person to a group." number 1
Maybe the problem is not in my script, but somewhere else?
--Gil