Manage Outlook contacts using AppleScript

Our contacts often share the same information. For example, we may know two or more people who work for the same company and share the same address, phone number and website. Invariably, as we add contacts, though, we sometimes enter slightly different information for each one. The first contact record may list a company name of “Microsoft” while a second lists “Microsoft Corporation”.

Using Outlook’s AppleScript capabilities, we can standardize this information in our contacts. I’ll first show how to make an Automator action that enables you to select multiple contacts and set the same field to the same information in all of them. Then I’ll provide an AppleScript that does something Outlook should already do: allow us to duplicate a contact record so that we can quickly add someone new.

For those who are uncomfortable with scripting, I’ve made Standardize Contacts 1.0 and Duplicate Contacts 1.0 available for download.

Create an Automator workflow to standardize contacts

Automator gives non-scripters a simple way to use AppleScript. Microsoft Office for Mac 2011 comes with nearly 100 actions that each do one thing such as creating a new workbook in Excel or converting PowerPoint slides to movies. Outlook itself has 21 various actions that can be strung together in a list in Automator to accomplish some complex feats. We’ll use two of these actions called Get Selected Outlook Items and Set Outlook Contact Properties.

  1. Launch the application found in the /Applications folder. When prompted, select Workflow and click the Choose button.

    Automator choose workflow

  2. Locate Microsoft Outlook in the Library on the left and select it. Locate the Get Selected Outlook Items and Set Outlook Contact Properties actions in the middle column. Drag them into the workflow area on the far right.

    Note how the first action hooks into the second action. This illustrates the workflow we’ll be using, which is to take the selected items and set the properties of each.

    Automator add actions

  3. Click Options at the bottom of the Set Outlook Contact Properties action and select Show this action when the workflow runs.

    Automator set options

  4. Select Save… from the File menu and name the new workflow “Standardize Contacts.workflow”. Save this new file into your Outlook Script Menu Items folder located in your home folder (where ” ~ ” denotes your home folder):

    ~/Documents/Microsoft User Data/Outlook Script Menu Items

    Automator save workflow

Once the workflow is saved it’s ready to use. My company “Merrill” has rebranded itself a few times and goes by an assortment of names such as “Merrill”, “Merrill Corporation” and “Merrill Communications LLC”. Our current branding prefers we standardize on “Merrill Communications LLC”.

To standardize my company contacts, I simply search for “Merrill” and select all the found contacts.

Automator before

I then select my Standardize Contacts workflow from the AppleScript menu in Outlook.

Automator Standardize Contacts

In the dialog window that appears, I select the Company property and enter “Merrill Communications LLC” as the value. I then click the Continue button.

Automator company name

The Company fields are now the same across my contacts.

Automator standardized

If you’re uncomfortable with creating an Automator workflow then you may download Standardize Contacts 1.0.

Create an AppleScript to duplicate contacts

While this does involve using the AppleScript Editor application, I’d rank it a “1” on an easiness scale of “1-5”. It’s very simple to copy and paste or retype the code below and save it as a file.

  1. Launch the AppleScript application found in /Applications/Utilities/.
  2. Enter the following script into the new script window. The line that begins with “display dialog” and the next line are actually one long line.
  3. Select Save… from the File menu and name the new script “Duplicate Contact.scpt”. Save this new script into your Outlook Script Menu Items folder located in your home folder (where ” ~ ” denotes your home folder):
  4. ~/Documents/Microsoft User Data/Outlook Script Menu Items

Once the script is saved it’s ready to use. To duplicate one or more contacts, select them in your Outlook Address Book or Exchange Contacts list and then select Duplicate Contact from the AppleScript menu in Outlook.

AppleScript select script

Each selected contact will be duplicated into the same address book or Exchange Contacts list as the original.

If you’re uncomfortable with using AppleScript then you may download Duplicate Contacts 1.0.

Share this:
  • Twitter
  • Facebook
  • Digg
  • StumbleUpon
  • Google Bookmarks
  • PDF
  • Print

2 comments to Manage Outlook contacts using AppleScript

  • Joseph Tan

    Thank you very very much for the above. I am still very new to Apple as I am in the infant stage of migrating from PC base. This is my first time to know Automator Workflow and AppleScript. Thanks for making this so simple for a beginner.

  • Alex Gotzner

    I was missing the Duplicate Contact feature of the Outlook Win versions very much – like some other very often used features of these versions. The AppleScript “workaround” is very helpful for the moment. Thank you very much for your work.