• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Adding a person to a group in Contacts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding a person to a group in Contacts


  • Subject: Re: Adding a person to a group in Contacts
  • From: Gil Dawson <email@hidden>
  • Date: Sat, 27 Feb 2016 13:43:57 -0800

Thanks, Andrew--

On Feb 27, 2016, at 1:12 PM, Andrew Oliver <email@hidden> wrote:

Why not just:

add somePerson to theKnownGroup

There’s no reason to futz with IDs. I generally avoid them as much as possible.

I agree.  That was one of my four tests.  It got the same error message as my other three variations.

Here's another run using that syntax:

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

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Adding a person to a group in Contacts
      • From: Andrew Oliver <email@hidden>
References: 
 >Adding a person to a group in Contacts (From: Gil Dawson <email@hidden>)
 >Re: Adding a person to a group in Contacts (From: Andrew Oliver <email@hidden>)

  • Prev by Date: Re: Adding a person to a group in Contacts
  • Next by Date: Re: Adding a person to a group in Contacts
  • Previous by thread: Re: Adding a person to a group in Contacts
  • Next by thread: Re: Adding a person to a group in Contacts
  • Index(es):
    • Date
    • Thread