Applescript to add a note to multiple contacts

Hi
I wonder if someone well versed in Applescript could help me with this?
For each contact, I need to add their group names to the existing notes field, something like this:
Groups: Work, Christmas card
Why do I want to? Because I am moving to Kerio Mail Server but it has an unfortunate issue that it loses group memberships when syncing address book. I can work round this for now if I store the group memberships in the notes field - but I need to update all my existing contacts.
Can anyone help?
TIA

Try this:tell application "Address Book"
set r to display dialog "Do you want to change all people or just the selected people?" buttons {"All", "Selected"} default button "Selected"
if the button returned of r is "Selected" then
set thePeople to selection
else
set thePeople to people
end if
repeat with aPerson in thePeople
set oldNotes to note of aPerson
set theGroups to {}
repeat with aGroup in (groups whose people contains aPerson)
set theGroups to theGroups & (name of aGroup)
end repeat
if theGroups is not {} then
set AppleScript's text item delimiters to ", "
if oldNotes is not missing value then
set note of aPerson to oldNotes & return & "Groups: " & (theGroups as string)
else
set note of aPerson to "Groups: " & (text items of theGroups as string)
end if
set AppleScript's text item delimiters to " "
end if
end repeat
save addressbook
end tell
It will ask if you want to do all or just selected contacts.
I don't know how long it will take to go through each contact. I only tested the "Selected" part as I didn't want to have to fix my entire address book.
Now, if you export them all to vCards, Address Book adds the groups to "CATEGORIES:" on the vCard. I don't know if you can make use of that, instead. Can you define anything on the import, like map Categories to some field in Kerio?

Similar Messages

  • Add field not showing in contacts edit screen

    Trying to add nick names to the contact list in IPhone 6, but the "add field" prompt is not showing. Tips?

    Well first of all PL10 has some addon-issues (I don't think they affect Screen Painter since that is only UI-API but I would not recommend it...)
    Regarding the problem...
    What you should try to do is go to "C:\Program Files\SAP\SAP Business One" (Perhaps "C:\Program Files\SAP Manage\SAP Business One") and delete or rename files "AddOnsInstall.sbo" and "AddOnsLocalRegistration.sbo".. These files controls installed addons on the client, and if you remove them the addon will try to reinstall the addon...
    Also try to go to %temp%\SM_OBS_DLL and delete/rename this as well... Controls versions of the SDK and there might be some left-overs from older versions
    If that not work try to go to the SARI table in the SBO-Common and delete the record regarding the Screen Painter
    If all the fails the old trick to uninstall the SDK, DI-API and client and reinstall them again sometimes solves the problems... (I know... Lots of things can go wrong in SBo and I've seen most of them)

  • Add area codes to multiple contacts in address book

    We are having to add area codes to contacts due to having to dial 10 digit phone numbers. Is there a way to do this for multiple contacts at once, rther than changing each one?

    Export your database to a csv file, open in a spreadsheet, add area codes and then bring the file back.

  • Adding notes to Mutliple Contacts in Address Book

    Does anyone know how to add a note to multiple contacts in address book? For example I have a list of people I sent holiday cards to and would like to add a note "Holiday Card 2005" to each contact. I do not want to create a "Group".
    Thanks!
    iMac G4   Mac OS X (10.4.4)  

    There's currently no way to do this within the application, but Address Book's applescript support should make this possible. You can select a number of records, and have a script operate on the people within the selection.

  • Why don't the notes inside each contact sync from my Outlook on my laptop to my iphone

    Why don't the notes I create inside an indiviual contact sync with my iphone?

    I'm not certain why they are not syncing. It can be addressed in a couple of different ways. You could reset the sync history and see if that helps. There is a way to add a note to a contact in the iPhone by going to edit for a contact and then scroll to the bottom and select "add field" and select note. If you already have a note added, it should appear below the contact's information and above the buttons for text message, Facetime, etc.

  • How can I add multiple contacts to a text message on a droid bionic

    How can I add multiple contacts to a text message on a droid bionic?

    DH
    I was thinking that if he wanted to create multiple keyframes he might be creating a repeated effect rather than manipulating values that are shot specific - like creating an oscillation or some repeated step effect.  If he was creating keyframes specific to his content he'd probably not look for a way to do it "quickly" since each keyframe would require manipulation of specific values. 
    So my thought was to generate the series of keyframes on a dummy clip created for this specific purpose, copy the clip, paste attributes (maybe turn off "Scale Attribute Times") and add bunches of keyframes at once. 
    Still, you're right, it's tough to divine the intent of someone very new to FCP.  His question could be based on a misunderstanding about the use of keyframes.
    P

  • Applescript to Add Same Photo to a Group of Contacts

    Can anyone please help with an Applescript to add an image to a group of contacts in one foul swoop.
    My intention is to add a logo image to a group of colleagues.
    Here is what I have so far, - but receive this error
    tell application "Address Book"
    set the_people to every person in group "Pilots"
    repeat with this_person in the_people
    set pict_file to choose file of type "TIFF" with prompt "Choose a tiff file"
    open for access pict_file
    close access pict_file
    set image of person to pict_file
    try
    end try
    end repeat
    end tell
    The error I receive is
    error "Can’t set «class az50» of «class azf4» to alias \"Macintosh HD:Users:Steven:Desktop: Pilot2.tiff\"." number -10006 from «class az50» of «class azf4»
    I would like to reference the image file to the script and not have to reselect it for every record.
    Thanks in Advance.

    You might have a look at [this article|http://smithsrus.com/setting-an-address-book-picture-with-applescript> and try this:
    *set pict_file to choose file of type {"public.tiff"} with prompt "Choose a TIFF file"*
    *open for access pict_file*
    *set pict_data to read pict_file as "TIFF"*
    *close access pict_file*
    *tell application "Address Book"*
    *set the_people to every person in group "Pilots"*
    *repeat with this_person in the_people*
    *set image of this_person to pict_data*
    *end repeat*
    *end tell*

  • How do I add multiple contacts to a group?

    How do I add multiple contacts to a group on my Ipad?

    See if this thread helps.
    https://discussions.apple.com/thread/4114588
    Matt

  • How do I add multiple contacts in a category in mail

    How do I add multiple contacts in a category in mail so I don't have to add them one at a time when I receive an email with multiple recipients in the CC?
    Thanks in advanced,
    Bill

    See if this thread helps.
    https://discussions.apple.com/thread/4114588
    Matt

  • Switched from Samsung Note 2 to iphone 6. Faced Difficulties while sending message. [1]Multiple Selection of receipients is not available. Eg. If I click plus, it shows me all the contacts but i cannot select multiple contacts using checkbox

    Phone : IPhone 6
    OS : 8.1
    Problem Statement : Multiple Selection of Recipients while drafting New Message in SMS.
    Expected Solution : Checkbox should have been provided to select multiple contacts using one screen

    Thanks for the reply.. I also tried that way.. I face couple of issues
    1) I could not find an option of saving a Draft Message
    2) After multiple recipients(I have selected 12 recipients) in "TO" section, if I type a word in "TO" such as "Pre", it shows me all the contacts containing "Pre"  but I cannot select the last contact incase there are more than 20 contacts coz I am unable to scroll down till the end.. If I do so.. I cannot select coz screen scrolls up automatically..
    Pls try ... If required I will insert video

  • Not able to add photo/image to an contact

    Not able to add photo/image to an contact. while croping an image during addtion the contacts app reports "unable to save photo edits.
    Tried clearing data/cache/reboot.. tried even with file manager, google photos app etc...
    Any solutions....??
    Solved!
    Go to Solution.

    You could go for a software repair,see if that helps:
    http://www.sonymobile.com/gb/tools/update-service/
    All we have to decide is what to do with the time that is given to us - J.R.R. Tolkien

  • Contact not saving, multiple cards created.

    Hello,
    So I have a bunch of people I'm trying to manage for a project, and in order to keep their emails straight I tried adding them to my contacts so that their name appears instead of whatever weird email address they have.  However in the case of one of them imail or contacts is refusing to display their name.  I create the contact, open the contact card, type in their name and click done, and then when I switch back to the email the address is still there and moreover has switched back to a person not in my contacts and gives me the option to add them AGAIN.  I've done this several times and it's driving me insane.  What is going on?
    Thank you,
    Jessica

    Try going to Mail/Window/Previous Recipients and deleting the address that keeps coming up.

  • HT2480 In my gmail account info I do not have a contacts bar that I can turn off and on.  How can I add that?

    In my gmail account info in settings mail contacts calendars I now do not have a contacts bar that I can turn off and on.  Just updated phone and lost it.
    What can I do to add it back?

    In my gmail account info in settings mail contacts calendars I now do not have a contacts bar that I can turn off and on.  Just updated phone and lost it.
    What can I do to add it back?

  • Why with Maverick can I NOT send an email to Multiple contacts?

    Why with Maverick can I not send an email to multiple contacts,? (no problems with Mountain Lion)

    I have been having problems with addressing  group emails I think only since Maverick. I have been unable to drag the group or copy the addresses into the "To" or "cc".
    However if I have 2 groups (Say "Family Close" and "Family Others" if one TYPES  Family in the "To" space the alternative are shown and when one clicks on one of these the "Bolded"  group is shown and can be expanded etc
    Bob Wines

  • Is there a way for the Yosemite maps app to add address to an existing contact (in contacts app) instead of creating new contact record with blank name (not useful)?

    I was using the maps app in yosemite to look up an address, once I was able to verify the address, I wanted to add that address to an existing contact record in the contacts app.  When I clicked on the option to add address to contacts, it unfortunately creates a new record with the address in it, however, the rest of the contact is blank. 
    My question is: is there a way to prompt the user (me), to select whether they want to create a new contact or add it to an existing contact?
    Thanks in advance for your help!
    Regards,
    Peter

    I was using the maps app in yosemite to look up an address, once I was able to verify the address, I wanted to add that address to an existing contact record in the contacts app.  When I clicked on the option to add address to contacts, it unfortunately creates a new record with the address in it, however, the rest of the contact is blank. 
    My question is: is there a way to prompt the user (me), to select whether they want to create a new contact or add it to an existing contact?
    Thanks in advance for your help!
    Regards,
    Peter

Maybe you are looking for