Re: AppleScripting Contacts - cannot add a person to a group
Re: AppleScripting Contacts - cannot add a person to a group
- Subject: Re: AppleScripting Contacts - cannot add a person to a group
- From: Christopher Stone <email@hidden>
- Date: Sat, 02 Jun 2018 01:04:10 -0500
On 06/02/2018, at 00:20, John Mitchell <email@hidden
<mailto:email@hidden>> wrote:
> I’m trying to create a Group in Contacts and add persons to it.
Hey John,
This works.
--
Take Care,
Chris
----------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2014/06/07 19:33
# dMod: 2018/06/02 01:01
# Appl: Contacts
# Task: Create a new contact group with specific contacts.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Contacts, @Create, @New, @Group
----------------------------------------------------------------
tell application "Contacts"
set contactsToAdd to people whose last name starts with "a"
if length of contactsToAdd > 0 then
if (group "Test_Make_New_Group" exists) = false then
set newGroup to make new group with properties
{name:"Test_Make_New_Group"}
tell newGroup
save
set selected of it to true
end tell
repeat with theContact in contactsToAdd
add theContact to newGroup
end repeat
save newGroup
end if
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