• 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: As and Contact Lists
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: As and Contact Lists


  • Subject: Re: As and Contact Lists
  • From: Christopher Stone <email@hidden>
  • Date: Sat, 07 Jun 2014 20:04:49 -0500

On Jun 07, 2014, at 19:07, Christopher Stone <email@hidden> wrote:
# Create a new group in Contacts with your specified members:
______________________________________________________________________

Whups.  I dumped my add-contacts code in the wrong if statement, so they weren't created unless the group already existed.

Fixed.

--
Best Regards,
Chris

-------------------------------------------------------------------------------------------
tell application "Contacts"
  set contactsToAdd to people whose last name starts with "a"

  

  if length of contactsToAdd > 0 then

    

    if (group "New_Sort" exists) = false then
      set newGroup to make new group with properties {name:"New_Sort"}

      

      tell newGroup
        save
        set selected of it to true
      end tell

      

    else

      

      tell group "New_Sort"
        if selected of it = false then set selected of it to true
        if (count of its people) > 0 then
          delete every person of it
          save
        end if
      end tell

      

    end if

    

    repeat with i in contactsToAdd
      add i to group "New_Sort"
    end repeat
    save group "New_Sort"

    

  end if
end tell
-------------------------------------------------------------------------------------------

 _______________________________________________
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

References: 
 >As and Contact Lists (From: Robert Cuilla <email@hidden>)
 >Re: As and Contact Lists (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: As and Contact Lists
  • Next by Date: Re: Any Way to Force an Idle Handler System Call? (Redux)
  • Previous by thread: Re: As and Contact Lists
  • Next by thread: Re: AppleScript-Users Digest, Vol 11, Issue 219
  • Index(es):
    • Date
    • Thread