Outlook 2011 To Evernote

Shared By: Justin

Description

Updated on February 28, 2013

Mac users who have corporate IT people setting up their computers (or anyone who needs fuller Exchange support) often use Outlook 2011 (part of Microsoft’s Office:mac 2011 package) as their email application. This free script lets you send items directly to Evernote with a keystroke and, if you like, even tag and sort them on the way in!

The script sends any type of Outlook item/items (messages, tasks, notes, calendar items, and contacts) to Evernote — and even from highlighted text within an item. GROWL notifications give you status updates as things are added into Evernote.

Evernote Contact Links

Clickable Links Allow You To Map, Dial, and Email Faster!

“Does it handle attachments?”, you ask. Yes — they are also included in the Evernote item!

The script includes full HTML in the items whenever possible — and I even took the time to make it so you’d have clickable links for contact information to help you quickly map addresses, call telephone numbers, etc. The note template is also fully customizable, allowing anyone with basic HTML knowledge to make their own layout. (I kept it pretty basic in this version)

Adding By Script Vs. Adding By Email

One fast way to get items into Evernote is simply to email them. Brett Kelly’s eBook, “Evernote Essentials” provides a solid guide to how this works (See the chapter called “Evernote, Email and You”) along with some other great email-related tips. So why not just forward items to your Evernote email address?

You certainly can do that — but I think this approach is actually easier and also has a few additional benefits:

  • FASTER/SMARTER WORKFLOW. By following the special file-naming convention in the Microsoft Outlook Script Menu (see instructions below), you can use Keyboard Shortcuts that make it incredibly fast and easy to stay organized! Personally, I use ⌘E to quickly send anything to Evernote. I can also tag and direct multiple items to a notebook by using a simple, fast dialog box instead of having to email them in one at a time (Example – Outlook handles multiple emails being forwarded by attaching them as .eml files to a single email). Trust me — Archiving whole folders goes much faster when you don’t have to send an email for every item! But the script isn’t just good for big, bulky moves: I can also send less than a whole item, quickly clipping only the bits of highlighted text I’m interested in.

  • BETTER USABILITY. Ever try to share Outlook contact information with people quickly? You can use Outlook’s “Forward Contact Information” function, but that just puts a vCard into an email. Not everyone is able to read that information easily — especially if they’re working from their mobile phone. This script creates readable, rich text information in Evernote as well as attaching a vCard. You can email it, share it with larger groups using Evernote’s Shared Notebooks, post a link to it — whatever is the most useful to you! And by creating basic templates to display Contact and Calendar information, the information is searchable using Evernote’s internal indexing… and accessible no matter where you are.

  • NO INTERNET NEEDED. Emailing an item into Evernote probably isn’t an option if you have local, non-synchronized notebooks which contain sensitive information (or should you find yourself without an internet connection). This script moves things directly

Important Notes and Requirements

  • I updated the script to use the newer GROWL app and, at this point, I feel like the script is solid enough to take it out of “beta” and give it its 1.0 birthday!

  • THIS SCRIPT REQUIRES OUTLOOK 2011 SP1 (Version 14.1.0 or Greater) and GROWL and will not compile without them. I’ve configured it to use the newer, App Store version of GROWL. (People with the older, non-App Store version of GROWL can try to do a quick Find-and-Replace on the script, substituting “GrowlHelperApp” for “Growl” wherever it appears in the script.)

  • Did you recently update Outlook 2011 to SP2 and discover this AppleScript isn’t working anymore? That’s because the Microsoft is using a different directory. With SP1 it was using:

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

    After upgrade to SP2, it is now using:

    ~/Library/Application Support/Microsoft/Office/Outlook Script Menu Items

    You can install a fresh version in the new location or just copy your scripts to the new location! (Thanks to Jim Dryfoos for pointing out the change!)

INSTALLATION

  • On this page, click the link below “The Code” preview window which says “Click here to open it in your Script Editor”. This will open the AppleScript inside your system’s default AppleScript Editor application.
  • Save this script to ~/Documents/Microsoft User Data/Outlook Script Menu Items (Or Its Equivalent in Localized Language). You can navigate quickly to this folder by selecting Outlook’s Script Menu => About This Menu… => Open Folder)
  • The Script Menu:



    …and the “Open Folder” button:

  • Give it a filename that enables a keyboard shortcut to be used.

    Example:
    “Send to Evernote\mE.scpt” lets you press ⌘E to send items to Evernote!

  • Take a moment to review the “User Switches” Configuration at the beginning of the script before saving it. You’ll find the ability to change certain defaults, including turning on a dialog box which lets you tag and sort items on the way in!

Enjoy — and don’t forget…

Be sure to follow the Veritrope.com Twitter Feed for news about updates for this script (and many more!).

The Code

(*
Veritrope.com
OUTLOOK 2011 TO EVERNOTE
VERSION 1.05
February 28, 2013

// TERMS OF USE:
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.

// LIKE THIS SCRIPT?
If this AppleScript is helpful to you, please show your support here:
http://veritrope.com/support

// SCRIPT INFORMATION AND UPDATE PAGE
http://veritrope.com/code/outlook-2011-to-evernote

// REQUIREMENTS
THIS SCRIPT REQUIRES GROWL!
Get it here: http://bit.ly/GrowlApp
(More details on the script information page.)

//CHANGELOG
1.05    Fix for leading spaces in tags
1.04     Fixes for Attachements, Tagging
1.03     Added TO: / CC: Information to Email Messages
1.02     Added Meeting Organizer information
1.01     Removed unused code, Additional Tweak to GROWL code, Added Meeting Attendees
1.00     Tweak to GROWL code

// RECOMMENDED INSTALLATION INSTRUCTIONS:
1.)  Save this script to ~/Documents/Microsoft User Data/Outlook Script Menu Items (Or Its Equivalent in Localized Language);

(You can navigate quickly to this folder by selecting: Outlook's Script Menu => About This Menu… => Open Folder)

2.)  Give it a filename that enables a keyboard shortcut to be used.
   
Example: "Send to Evernote\mE.scpt" lets you press ⌘E to send items to Evernote!

3.) Enjoy!
   
*)


(*
======================================
// USER SWITCHES
======================================
*)


--SET THIS TO "OFF" IF YOU WANT TO SKIP THE TAGGING/NOTEBOOK DIALOG
--AND SEND ITEMS DIRECTLY INTO YOUR DEFAULT NOTEBOOK
property tagging_Switch : "OFF"

--IF YOU'VE DISABLED THE TAGGING/NOTEBOOK DIALOG,
--TYPE THE NAME OF THE NOTEBOOK YOU WANT TO SEND ITEM TO
--BETWEEN THE QUOTES IF IT ISN'T YOUR DEFAULT NOTEBOOK.
--(EMPTY SENDS TO DEFAULT)
property EVnotebook : ""

--IF TAGGING IS ON AND YOU'D LIKE TO CHANGE THE DEFAULT TAG,
--TYPE IT BETWEEN THE QUOTES (ITEM TYPE IS DEFAULT)
property defaultTag : ""

(*
======================================
// OTHER PROPERTIES
======================================
*)

property successCount : 0
property growl_Running : "false"
property appName : "Growl"
property account_Type : "free"
property myTitle : "Item"
property theAttachments : ""
property thisMessage : ""
property itemNum : "0"
property attNum : "0"
property errNum : "0"
property userTag : ""
property EVTag : {}
property the_class : ""
property list_Props : {}
property SaveLoc : ""
property selectedItem : {}
property t_List : {}
property c_List : {}

(*
======================================
// MAIN PROGRAM
======================================
*)


--RESET ITEMS
set successCount to "0"
set AppleScript's text item delimiters to ""
set selectedItems to {}
set ExportFolder to ""
set SaveLoc to ""

--LET'S GO!
try
    --CHECK FOR GROWL
    my Growl_Check()
   
    --SET UP ACTIVITIES
    set selectedItems to my item_Check()
   
    --MESSAGES SELECTED?
    if selectedItems is not missing value then
       
        --GET FILE COUNT
        my item_Count(selectedItems, the_class)
       
        --ANNOUNCE THE EXPORT OF ITEMS
        if growl_Running is true then
            my process_Items(itemNum, attNum, the_class)
        end if
       
        --CHECK EVERNOTE ACCOUNT TYPE
        my account_Check()
       
        --PROCESS ITEMS FOR EXPORT
        my item_Process(selectedItems)
       
        --DELETE TEMP FOLDER IF IT EXISTS
        set success to my trashfolder(SaveLoc)
       
        --NO ITEMS SELECTED
    else
        set successCount to -1
    end if
   
    --GROWL RESULTS
    if growl_Running is true then
        my growl_Growler(growl_Running, successCount)
    end if
   
    -- ERROR HANDLING
on error errText number errNum
    if growl_Running is true then
        if errNum is -128 then
            -- GROWL FAILURE FOR CANCEL
            tell application "Growl"
                notify with name ¬
                    "Failure Notification" title ¬
                    "User Cancelled" description ¬
                    "Failed to export!" application name "Outlook to Evernote"
            end tell
        else
           
            -- GROWL FAILURE FOR ERROR
            tell application "Growl"
                notify with name ¬
                    "Failure Notification" title ¬
                    "Import Failure" description "Failed to export " & return & myTitle & ¬
                    "\"  due to the following error: " & return & errText ¬
                    application name "Outlook to Evernote"
            end tell
        end if
    else if growl_Running is false then
       
        -- NON-GROWL ERROR MSG. FOR ERROR
        display dialog "Item Failed to Import: " & errNum & return & errText with icon 0
    end if
end try

(*
======================================
// PREPARATORY SUBROUTINES
=======================================
*)


--APP DETECT
on appIsRunning(appName)
    tell application "System Events"
        set growlRunning to (count of (every process whose bundle identifier is "com.Growl.GrowlHelperApp")) > 0
    end tell
end appIsRunning

--CHECK ACCOUNT TYPE
on account_Check()
    tell application "Evernote"
        set account_Info to (properties of account info 1)
        set account_Type to (account type of account_Info) as text
        if EVnotebook is "" then set EVnotebook to my default_Notebook()
    end tell
end account_Check

--SET UP ACTIVITIES
on item_Check()
    --set myPath to (path to home folder)
    tell application "Microsoft Outlook"
        try -- GET MESSAGES
            set selectedItems to selection
            set raw_Class to (class of selectedItems)
            if raw_Class is list then
                set classList to {}
                repeat with selectedItem in selectedItems
                    copy class of selectedItem to end of classList
                end repeat
                if classList contains task then
                    set the_class to "Task"
                else
                    set raw_Class to (class of item 1 of selectedItems)
                end if
            end if
            if raw_Class is calendar event then set the_class to "Calendar"
            if raw_Class is note then set the_class to "Note"
            if raw_Class is task then set the_class to "Task"
            if raw_Class is contact then set the_class to "Contact"
            if raw_Class is incoming message then set the_class to "Message"
            if raw_Class is text then set the_class to "Text"
            if defaultTag is "" then set defaultTag to the_class
        end try
        return selectedItems
    end tell
end item_Check

--GET COUNT OF ITEMS AND ATTACHMENTS
on item_Count(selectedItems)
    tell application "Microsoft Outlook"
        if the_class is not "Text" then
            set itemNum to count of selectedItems
            set attNum to 0
            try
                repeat with selectedMessage in selectedItems
                    set attNum to attNum + (count of attachment of selectedMessage)
                end repeat
            end try
        else
            set itemNum to 1
        end if
    end tell
end item_Count

(*
======================================
// PROCESS OUTLOOK ITEMS SUBROUTINE
======================================
*)


on item_Process(selectedItems)
    tell application "Microsoft Outlook"
       
        --TAGGING?
        if tagging_Switch is "ON" then my tagging_Dialog()
       
        --TEXT CLIPPING?
        if (class of selectedItems) is text then
            set EVTitle to "Text Clipping from Outlook"
            set theContent to selectedItems
            --CREATE IN EVERNOTE
            tell application "Evernote"
                set theNote to create note with text theContent title EVTitle notebook EVnotebook
                if EVTag is not {} then assign EVTag to theNote
            end tell
           
            --ITEM HAS FINISHED -- COUNT IT AS A SUCCESS!
            set successCount to 1
        else
            -- GET OUTLOOK ITEM INFORMATION
            repeat with selectedItem in selectedItems
                try
                    set theAttachments to attachments of selectedItem
                    set raw_Attendees to attendees of selectedItem
                end try
               
                try
                    set t_List to {}
                    set c_List to {}
                   
                    --LOOK FOR "TO: RECIPIENTS" AND MAKE LIST
                    set t_Recipients to (to recipients of selectedItem)
                    set t_Count to (count of t_Recipients)
                    set t_Mult to ", "
                    repeat with t_Recipient in t_Recipients
                        set t_Completed to false
                        if t_Count is 1 then set t_Mult to ""
                        set t_Address to (email address of t_Recipient)
                        try
                            set t_Name to (name of t_Address)
                            set t_List to t_List & {t_Name & " (" & (address of t_Address) & ")" & t_Mult} as string
                            set t_Completed to true
                        end try
                        if t_Completed is false then
                            set t_List to t_List & {(address of t_Address) & t_Mult} as string
                        end if
                        set t_Count to (t_Count - 1)
                    end repeat
                   
                   
                   
                    --LOOK FOR "CC: RECIPIENTS" AND MAKE LIST
                    set c_Recipients to (cc recipients of selectedItem)
                    set c_Count to (count of c_Recipients)
                    set c_Mult to ", "
                    repeat with c_Recipient in c_Recipients
                        set c_Completed to false
                        if c_Count is 1 then set c_Mult to ""
                        set c_Address to (email address of c_Recipient)
                        try
                            set c_Name to (name of c_Address)
                            set c_List to c_List & {c_Name & " (" & (address of c_Address) & ")" & c_Mult} as string
                            set c_Completed to true
                        end try
                        if c_Completed is false then
                            set c_List to c_List & {(address of c_Address) & c_Mult} as string
                        end if
                        set c_Count to (c_Count - 1)
                    end repeat
                   
                end try
               
                set selectedItem to (properties of selectedItem)
                set the_vCard to {}
                set the_notes to ""
               
                --WHAT KIND OF ITEM IS IT?
                if the_class is "Calendar" then
                   
                    (* // CALENDAR ITEM *)
                   
                    --PREPARE THE TEMPLATE 
                    --LEFT SIDE (FORM FIELDS)
                    set l_1 to "Event:"
                    set l_2 to "Start Time:"
                    set l_3 to "End Time:"
                    set l_4 to "Location:"
                    set l_5 to "Notes:"
                   
                    --RIGHT SIDE (DATA FIELDS)
                    set r_1 to (subject of selectedItem)
                    set r_2 to (start time of selectedItem)
                    set r_3 to (end time of selectedItem)
                    set the_Location to (location of selectedItem)
                    if the_Location is missing value then set the_Location to "None"
                    set r_4 to the_Location
                   
                    --THE NOTES
                    set the_notes to ""
                    set item_Created to (current date)
                    try
                        set the_notes to (content of selectedItem)
                    end try
                    if the_notes is missing value then set the_notes to ""
                   
                    --ADD ORGANIZER / ATTENDEE INFO IF IT'S A MEETING
                    if (count of raw_Attendees) > 0 then
                        set the_Organizer to "<strong>Organized By: </strong><br/>" & (organizer of selectedItem) & "<br/><br/>"
                        set the_Attendees to "<strong>Invited Attendees: </strong><br/>"
                        repeat with raw_Attendee in raw_Attendees
                           
                            --GET ATTENDEE DATA
                            set raw_EmailAttendee to (email address of raw_Attendee)
                            set attend_Name to (name of raw_EmailAttendee) as text
                            set raw_Status to (status of raw_Attendee)
                           
                            --COERCE STATUS TO TEXT
                            if raw_Status contains not responded then
                                set attend_Status to "Not Responded"
                            else if raw_Status contains accepted then
                                set attend_Status to "Accepted"
                            else if raw_Status contains declined then
                                set attend_Status to "Declined"
                            else if raw_Status contains tentatively accepted then
                                set attend_Status to "Tentatively Accepted"
                            end if
                           
                            --COMPILE THE ATTENDEE DATA
                            set attend_String to attend_Name & " (" & attend_Status & ")<br/>"
                            set the_Attendees to the_Attendees & attend_String
                        end repeat
                        set the_notes to (the_Organizer & the_Attendees & the_notes)
                        set raw_Attendees to ""
                    end if
                   
                    --ASSEMBLE THE TEMPLATE
                    set theContent to my make_Template(l_1, l_2, l_3, l_4, l_5, r_1, r_2, r_3, r_4, the_notes)
                   
                    --EXPORT VCARD DATA
                    try
                        set vcard_data to (icalendar data of selectedItem)
                        set vcard_extension to ".ics"
                        set the_vCard to my write_File(r_1, vcard_data, vcard_extension)
                    end try
                   
                    set theHTML to true
                    set EVTitle to r_1
                   
                    (* // NOTE ITEM *)
                else if the_class is "note" then
                   
                    --PREPARE THE TEMPLATE 
                    --LEFT SIDE (FORM FIELDS)
                    set l_1 to "Note:"
                    set l_2 to "Creation Date:"
                    set l_3 to "Category"
                    set l_4 to ""
                    set l_5 to "Notes:"
                   
                    --RIGHT SIDE (DATA FIELDS)
                    set r_1 to name of selectedItem
                    set item_Created to creation date of selectedItem
                    set r_2 to (item_Created as text)
                   
                    --GET CATEGORY INFO
                    set the_Cats to (category of selectedItem)
                    set list_Cats to {}
                    set count_Cat to (count of the_Cats)
                    repeat with the_Cat in the_Cats
                        set cat_Name to (name of the_Cat as text)
                        copy cat_Name to the end of list_Cats
                        if count_Cat > 1 then
                            copy ", " to the end of list_Cats
                            set count_Cat to (count_Cat - 1)
                        else
                            set count_Cat to (count_Cat - 1)
                        end if
                    end repeat
                   
                    set r_3 to list_Cats
                    set r_4 to ""
                   
                    set item_Created to creation date of selectedItem
                   
                    --THE NOTES
                    try
                        set the_notes to content of selectedItem
                    end try
                    if the_notes is missing value then set the_notes to ""
                   
                    --ASSEMBLE THE TEMPLATE
                    set theContent to my make_Template(l_1, l_2, l_3, l_4, l_5, r_1, r_2, r_3, r_4, the_notes)
                   
                    --EXPORT VCARD DATA
                    set vcard_data to (icalendar data of selectedItem)
                    set vcard_extension to ".ics"
                    set the_vCard to my write_File(r_1, vcard_data, vcard_extension)
                   
                    set theHTML to true
                    set EVTitle to r_1
                   
                    (* // CONTACT ITEM *)
                else if the_class is "contact" then
                   
                    --PREPARE THE TEMPLATE 
                    --LEFT SIDE (FORM FIELDS)
                    set l_1 to "Name:"
                    set l_2 to "Email:"
                    set l_3 to "Phone:"
                    set l_4 to "Address:"
                    set l_5 to "Notes:"
                   
                    --GET EMAIL INFO
                    try
                        set list_Addresses to {}
                        set email_Items to (email addresses of selectedItem)
                        repeat with email_Item in email_Items
                            set the_Type to (type of email_Item as text)
                            set addr_Item to (address of email_Item) & " (" & my TITLECASE(the_Type) & ")<br />" as text
                            copy addr_Item to the end of list_Addresses
                        end repeat
                    end try
                   
                    --GET PHONE INFO AND ENCODE TELEPHONE LINK
                    try
                        set list_Phone to {}
                        if business phone number of selectedItem is not missing value then
                            set b_Number to (business phone number of selectedItem)
                            set b_String to "<strong>Work: </strong><a href=\"tel:\\" & b_Number & "\">" & b_Number & "</a><br /><br />"
                            copy b_String to end of list_Phone
                        end if
                        if home phone number of selectedItem is not missing value then
                            set h_Number to (home phone number of selectedItem)
                            set h_String to "<p><strong>Home: </strong><a href=\"tel:\\" & h_Number & "\">" & h_Number & "<br /><br />"
                            copy h_String to end of list_Phone
                        end if
                        if mobile number of selectedItem is not missing value then
                            set m_Number to (mobile number of selectedItem)
                            set m_String to "<p><strong>Mobile: </strong><a href=\"tel:\\" & m_Number & "\">" & m_Number & "<br /><br />"
                            copy m_String to end of list_Phone
                        end if
                    end try
                   
                    --GET ADDRESS INFO
                    try
                        set list_Addr to {}
                       
                        (*BUSINESS *)
                        if business street address of selectedItem is not missing value then
                            set b_Str to (business street address of selectedItem)
                            set b_gStr to my encodedURL(b_Str)
                            if (business city of selectedItem) is not missing value then
                                set b_Cit to (business city of selectedItem)
                                set b_gCit to my encodedURL(b_Cit)
                            else
                                set b_Cit to ""
                                set b_gCit to ""
                            end if
                            if (business state of selectedItem) is not missing value then
                                set b_Sta to (business state of selectedItem)
                                set b_gSta to my encodedURL(b_Sta)
                            else
                                set b_Sta to ""
                                set b_gSta to ""
                            end if
                            if (business zip of selectedItem) is not missing value then
                                set b_Zip to (business zip of selectedItem)
                                set b_gZip to my encodedURL(b_Zip)
                            else
                                set b_Zip to ""
                                set b_gZip to ""
                            end if
                            if (business country of selectedItem) is not missing value then
                                set b_Cou to (business country of selectedItem)
                                set b_gCou to my encodedURL(b_Cou)
                            else
                                set b_Cou to ""
                                set b_gCou to ""
                            end if
                            set b_Addr to b_Str & "<br/>" & b_Cit & ", " & b_Sta & "  " & b_Zip & "<br/>" & b_Cou
                           
                            --GOOGLE MAPS LOCATION IN URL
                            set b_gString to b_gStr & "," & b_gCit & "," & b_gSta & "," & b_gZip & "," & b_gCou
                            set b_GMAP to "http://maps.google.com/maps?q=" & b_gString
                            set b_String to "<strong>Work: </strong><br /><a href=\"" & b_GMAP & "\">" & b_Addr & "</a><br /><br />"
                            copy b_String to end of list_Addr
                        end if
                       
                        (*HOME *)
                        if home street address of selectedItem is not missing value then
                            set h_Str to (home street address of selectedItem)
                            set h_gStr to my encodedURL(h_Str)
                            if (home city of selectedItem) is not missing value then
                                set h_Cit to (home city of selectedItem)
                                set h_gCit to my encodedURL(h_Cit)
                            else
                                set h_Cit to ""
                                set h_gCit to ""
                            end if
                            if (home state of selectedItem) is not missing value then
                                set h_Sta to (home state of selectedItem)
                                set h_gSta to my encodedURL(h_Sta)
                            else
                                set h_Sta to ""
                                set h_gSta to ""
                            end if
                            if (home zip of selectedItem) is not missing value then
                                set h_Zip to (home zip of selectedItem)
                                set h_gZip to my encodedURL(h_Zip)
                            else
                                set h_Zip to ""
                                set h_gZip to ""
                            end if
                            if (home country of selectedItem) is not missing value then
                                set h_Cou to (home country of selectedItem)
                                set h_gCou to my encodedURL(h_Cou)
                            else
                                set h_Cou to ""
                                set h_gCou to ""
                            end if
                            set h_Addr to h_Str & "<br/>" & h_Cit & ", " & h_Sta & "  " & h_Zip & "<br/>" & h_Cou
                           
                            --GOOGLE MAPS LOCATION IN URL
                            set h_gString to h_gStr & "," & h_gCit & "," & h_gSta & "," & h_gZip & "," & h_gCou
                            set h_GMAP to "http://maps.google.com/maps?q=" & h_gString
                            set h_String to "<strong>Home: </strong><br /><a href=\"" & h_GMAP & "\">" & h_Addr & "</a><br />"
                            copy h_String to end of list_Addr
                        end if
                    end try
                   
                    --RIGHT SIDE (DATA FIELDS)
                    set r_1 to (display name of selectedItem)
                    set r_2 to (list_Addresses as string)
                    set r_3 to (list_Phone as text)
                    set r_4 to (list_Addr as text)
                   
                    --EXPORT VCARD DATA
                    set vcard_data to (vcard data of selectedItem)
                    set vcard_extension to ".vcf"
                    set item_Created to (current date)
                   
                    --THE NOTES
                    try
                        set the_notes to plain text note of selectedItem
                        if the_notes is missing value then set the_notes to ""
                    end try
                   
                    --ASSEMBLE THE TEMPLATE
                    set theContent to my make_Template(l_1, l_2, l_3, l_4, l_5, r_1, r_2, r_3, r_4, the_notes)
                    set the_vCard to my write_File(r_1, vcard_data, vcard_extension)
                   
                    set theHTML to true
                    set EVTitle to r_1
                   
                    (* // TASK ITEM *)
                else if the_class is "task" then
                   
                    --PREPARE THE TEMPLATE 
                    --LEFT SIDE (FORM FIELDS)
                    set l_1 to "Note:"
                    set l_2 to "Priority:"
                    set l_3 to "Due Date:"
                    set l_4 to "Status:"
                    set l_5 to "Notes:"
                   
                    --RIGHT SIDE (DATA FIELDS)
                    set propClass to (class of selectedItem) as text
                    if propClass is "incoming message" then
                        set r_1 to (subject of selectedItem)
                    else
                        set r_1 to (name of selectedItem)
                    end if
                    set the_Priority to (priority of selectedItem)
                    if the_Priority is priority normal then set r_2 to "Normal"
                    if the_Priority is priority high then set r_2 to "High"
                    if the_Priority is priority low then set r_2 to "Low"
                   
                    set r_3 to (due date of selectedItem)
                    set item_Created to (current date)
                   
                    --TODO?
                    try
                        set todo_Flag to (todo flag of selectedItem) as text
                        set r_4 to my TITLECASE(todo_Flag)
                    end try
                   
                    --THE NOTES
                    try
                        if content of selectedItem is missing value then
                            set the_notes to plain text content of selectedItem
                        else
                            set the_notes to content of selectedItem
                        end if
                       
                    end try
                    if the_notes is missing value then set the_notes to ""
                   
                    --ASSEMBLE THE TEMPLATE
                    set theContent to my make_Template(l_1, l_2, l_3, l_4, l_5, r_1, r_2, r_3, r_4, the_notes)
                   
                    --EXPORT VCARD DATA
                    if propClass is not "incoming message" then
                        set vcard_extension to ".ics"
                        set vcard_data to (icalendar data of selectedItem)
                        set the_vCard to my write_File(r_1, vcard_data, vcard_extension)
                    end if
                   
                    set theHTML to true
                    set EVTitle to r_1
                   
                    (* // MESSAGE ITEM *)
                else
                    --PREPARE THE TEMPLATE 
                    --LEFT SIDE (FORM FIELDS)
                    set l_1 to "From: / To: / CC: "
                    set l_2 to "Subject:"
                    set l_3 to "Date:"
                    set l_4 to "Category:"
                    set l_5 to "Email Contents:"
                   
                    --GET EMAIL INFO
                    set the_Sender to (sender of selectedItem)
                    set s_Name to (address of the_Sender)
                    set s_Address to (address of the_Sender)
                   
                    --REPLACE WITH NAME, IF AVAILABLE
                    try
                        set s_Name to (name of the_Sender)
                    end try
                   
                    set sender_Link to "<a href=\"mailto:" & s_Address & "\">" & s_Name & " (" & s_Address & ")</a>"
                   
                    --GET CATEGORY INFO
                    set the_Cats to (category of selectedItem)
                    set list_Cats to {}
                    set count_Cat to (count of the_Cats)
                    repeat with the_Cat in the_Cats
                        set cat_Name to (name of the_Cat as text)
                        copy cat_Name to the end of list_Cats
                        if count_Cat > 1 then
                            copy ", " to the end of list_Cats
                            set count_Cat to (count_Cat - 1)
                        else
                            set count_Cat to (count_Cat - 1)
                        end if
                    end repeat
                   
                    --RIGHT SIDE (DATA FIELDS)
                    set r_1 to "From: " & sender_Link & "<hr/>To: " & t_List & "<hr/>CC: " & c_List
                   
                    set m_Sub to (subject of selectedItem)
                    if m_Sub is missing value then
                        set r_2 to "<No Subject>"
                    else
                        set r_2 to {subject of selectedItem}
                    end if
                    set r_3 to (time sent of selectedItem)
                    set r_4 to list_Cats
                   
                    set theID to id of selectedItem as string
                    set item_Created to r_3
                    set EVTitle to r_2
                   
                    --PROCESS EMAIL CONTENT
                    set m_Content to content of selectedItem
                    set theHTML to has html of selectedItem
                   
                    --IF PLAINTEXT EMAIL CONTENT…
                    if theHTML is false then
                        set theContent to "Name: " & s_Name & return & "Subject: " & r_2 & return & "Sent: " & r_3 & return & return & return & return & m_Content
                        --IF HTML EMAIL CONTENT…
                    else
                        set the_notes to m_Content
                        --ASSEMBLE THE TEMPLATE
                        set theContent to my make_Template(l_1, l_2, l_3, l_4, l_5, r_1, r_2, r_3, r_4, the_notes)
                    end if
                end if
               
                --CREATE NOTE IN EVERNOTE (FINALLY!)
                if theHTML is true then
                    tell application "Evernote"
                        set theNote to create note with html theContent title EVTitle notebook EVnotebook
                        if EVTag is not {} then assign EVTag to theNote
                        set creation date of theNote to item_Created
                       
                        --ATTACH VCARD (IF PRESENT)
                        if the_vCard is not {} then tell theNote to append attachment file the_vCard
                    end tell
                else
                    tell application "Evernote"
                        set theNote to create note with text theContent title EVTitle notebook EVnotebook
                        if EVTag is not {} then assign EVTag to theNote
                        set creation date of theNote to item_Created
                       
                        --ATTACH VCARD (IF PRESENT)
                        if the_vCard is not {} then tell theNote to append attachment file the_vCard
                    end tell
                end if
               
                --IF ATTACHMENTS PRESENT, RUN ATTACHMENT SUBROUTINE
                if theAttachments is not {} then my message_Attach(theAttachments, selectedItem, theNote)
               
                --ITEM HAS FINISHED! COUNT IT AS A SUCCESS AND RESET ATTACHMENTS!
                set successCount to successCount + 1
                set theAttachments to {}
            end repeat
        end if
    end tell
end item_Process


(*
======================================
// UTILITY SUBROUTINES
======================================
*)

--URL ENCODE
on encodedURL(the_Word)
    set scpt to "php -r 'echo urlencode(\"" & the_Word & "\");'"
    return do shell script scpt
end encodedURL

--TITLECASE
on TITLECASE(txt)
    return do shell script "python -c \"import sys; print unicode(sys.argv[1], 'utf8').title().encode('utf8')\" " & quoted form of txt
end TITLECASE

--SORT SUBROUTINE
on simple_sort(my_list)
    set the index_list to {}
    set the sorted_list to {}
    repeat (the number of items in my_list) times
        set the low_item to ""
        repeat with i from 1 to (number of items in my_list)
            if i is not in the index_list then
                set this_item to item i of my_list as text
                if the low_item is "" then
                    set the low_item to this_item
                    set the low_item_index to i
                else if this_item comes before the low_item then
                    set the low_item to this_item
                    set the low_item_index to i
                end if
            end if
        end repeat
        set the end of sorted_list to the low_item
        set the end of the index_list to the low_item_index
    end repeat
    return the sorted_list
end simple_sort

--REPLACE
on replaceString(theString, theOriginalString, theNewString)
    set theNum to 0
    set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, theOriginalString}
    set theStringParts to text items of theString
    if (count of theStringParts) is greater than 1 then
        set theString to text item 1 of theStringParts as string
        repeat with eachPart in items 2 thru -1 of theStringParts
            set theString to theString & theNewString & eachPart as string
            set theNum to theNum + 1
        end repeat
    end if
    set AppleScript's text item delimiters to od
    return theString
end replaceString


(*
======================================
// TAGGING SUBROUTINES
======================================
*)


--TAGGING AND NOTEBOOK SELECTION DIALOG
on tagging_Dialog()
    display dialog "Enter The Tag or Tags Below." & return & ¬
        "(NOTE: Multiple Tags Should Be Separated By Commas)" with title "Outlook to Evernote Export" default answer defaultTag ¬
        buttons {"Create in Default Notebook", "Select Notebook from List", "Cancel"} ¬
        default button "Create in Default Notebook" cancel button ¬
        "Cancel" with icon path to resource "Evernote.icns" in bundle (path to application "Evernote")
    set dialogresult to the result
    set userInput to text returned of dialogresult
    set ButtonSel to button returned of dialogresult
    set theDelims to {","}
    set userTag to my Tag_List(userInput, theDelims)
   
    --RESET, FINAL CHECK, AND FORMATTING OF TAGS
    set EVTag to {}
    set EVTag to my Tag_Check(userTag)
    if ButtonSel is "Select Notebook from List" then set EVnotebook to my Notebook_List()
end tagging_Dialog

--TAG SELECTION SUBROUTINE
on Tag_List(userInput, theDelims)
    set oldDelims to AppleScript's text item delimiters
    set theList to {userInput}
    repeat with aDelim in theDelims
        set AppleScript's text item delimiters to aDelim
        set newList to {}
        repeat with anItem in theList
            set newList to newList & text items of anItem
        end repeat
        set theList to newList
    end repeat
    set AppleScript's text item delimiters to oldDelims
    return theList
end Tag_List

--CREATES TAGS IF THEY DON'T EXIST
on Tag_Check(theTags)
    tell application "Evernote"
        set finalTags to {}
        repeat with theTag in theTags
           
            -- TRIM LEADING SPACE, IF ANY
            if (the character 1 of theTag is " ") then set theTag to text 2 thru end of theTag as text
           
            if (not (tag named theTag exists)) then
                try
                    set makeTag to make tag with properties {name:theTag}
                    set end of finalTags to makeTag
                end try
            else
                set end of finalTags to tag theTag
            end if
        end repeat
    end tell
    return finalTags
end Tag_Check

(*
======================================
// NOTEBOOK SUBROUTINES
======================================
*)


--GET EVERNOTE'S DEFAULT NOTEBOOK
on default_Notebook()
    tell application "Evernote"
        set get_defaultNotebook to every notebook whose default is true
        if EVnotebook is "" then
            set EVnotebook to name of (item 1 of get_defaultNotebook) as text
        end if
    end tell
end default_Notebook

--EVERNOTE NOTEBOOK SELECTION SUBROUTINE
on Notebook_List()
    tell application "Evernote"
        activate
        set listOfNotebooks to {} (*PREPARE TO GET EVERNOTE'S LIST OF NOTEBOOKS *)
        set EVNotebooks to every notebook (*GET THE NOTEBOOK LIST *)
        repeat with currentNotebook in EVNotebooks
            set currentNotebookName to (the name of currentNotebook)
            copy currentNotebookName to the end of listOfNotebooks
        end repeat
        set Folders_sorted to my simple_sort(listOfNotebooks) (*SORT THE LIST *)
        set SelNotebook to choose from list of Folders_sorted with title "Select Evernote Notebook" with prompt ¬
            "Current Evernote Notebooks" OK button name "OK" cancel button name "New Notebook" (*USER SELECTION FROM NOTEBOOK LIST *)
        if (SelNotebook is false) then (*CREATE NEW NOTEBOOK OPTION *)
            set userInput to ¬
                text returned of (display dialog "Enter New Notebook Name:" default answer "")
            set EVnotebook to userInput
        else
            set EVnotebook to item 1 of SelNotebook
        end if
    end tell
end Notebook_List

(*
======================================
// ATTACHMENT SUBROUTINES
=======================================
*)


--CLEAN TITLE FOR FILENAME
on clean_Title(rawFileName)
    set previousDelimiter to AppleScript's text item delimiters
    set potentialName to rawFileName
    set legalName to {}
    set illegalCharacters to {".", ",", "/", ":", "[", "]"}
    repeat with thisCharacter in the characters of potentialName
        set thisCharacter to thisCharacter as text
        if thisCharacter is not in illegalCharacters then
            set the end of legalName to thisCharacter
        else
            set the end of legalName to "_"
        end if
    end repeat
    return legalName
end clean_Title

--WRITE THE FILE
on write_File(r_1, vcard_data, vcard_extension)
    set ExportFolder to ((path to desktop folder) & "Temp Export From Outlook:") as string
    set SaveLoc to my f_exists(ExportFolder)
    set FileName to (my clean_Title(r_1) & vcard_extension)
    set theFileName to (ExportFolder & FileName)
    try
        open for access file theFileName with write permission
        write vcard_data to file theFileName as string
        close access file theFileName
        return theFileName
       
    on error errorMessage
        log errorMessage
        try
            close access file theFileName
        end try
    end try
end write_File

--FOLDER EXISTS
on f_exists(ExportFolder)
    try
        set myPath to (path to home folder)
        get ExportFolder as alias
        set SaveLoc to ExportFolder
    on error
        tell application "Finder" to make new folder with properties {name:"Temp Export From Outlook"}
    end try
end f_exists

--ATTACHMENT PROCESSING
on message_Attach(theAttachments, selectedItem, theNote)
    tell application "Microsoft Outlook"
        --MAKE SURE TEXT ITEM DELIMITERS ARE DEFAULT
        set AppleScript's text item delimiters to ""
       
        --TEMP FILES PROCESSED ON THE DESKTOP
        set ExportFolder to ((path to desktop folder) & "Temp Export From Outlook:") as string
        set SaveLoc to my f_exists(ExportFolder)
       
        --PROCESS THE ATTCHMENTS
        set attCount to 0
        repeat with theAttachment in theAttachments
            set theFileName to ExportFolder & theAttachment's name
            try
                save theAttachment in file theFileName
            end try
            tell application "Evernote"
                tell theNote to append attachment file theFileName
            end tell
           
            --SILENT DELETE OF TEMP FILE
            set trash_Folder to path to trash folder from user domain
            do shell script "mv " & quoted form of POSIX path of theFileName & space & quoted form of POSIX path of trash_Folder
        end repeat
    end tell
end message_Attach

--SILENT DELETE OF TEMP FOLDER (THANKS MARTIN MICHEL!)
on trashfolder(SaveLoc)
    try
        set trashfolderpath to ((path to trash) as Unicode text)
        set srcfolderinfo to info for (SaveLoc as alias)
        set srcfoldername to name of srcfolderinfo
        set SaveLoc to (SaveLoc as alias)
        set SaveLoc to (quoted form of POSIX path of SaveLoc)
        set counter to 0
        repeat
            if counter is equal to 0 then
                set destfolderpath to trashfolderpath & srcfoldername & ":"
            else
                set destfolderpath to trashfolderpath & srcfoldername & " " & counter & ":"
            end if
            try
                set destfolderalias to destfolderpath as alias
            on error
                exit repeat
            end try
            set counter to counter + 1
        end repeat
        set destfolderpath to quoted form of POSIX path of destfolderpath
        set command to "ditto " & SaveLoc & space & destfolderpath
        do shell script command
        -- this won't be executed if the ditto command errors
        set command to "rm -r " & SaveLoc
        do shell script command
        return true
    on error
        return false
    end try
end trashfolder

(*
======================================
// GROWL SUBROUTINES
======================================
*)


--CHECK FOR GROWL
on Growl_Check()
    if appIsRunning("GrowlHelperApp") then
        set growl_Running to true
        tell application "Growl"
            set allNotificationsFiles to {"Import To Evernote", "Success Notification", "Failure Notification"}
            set enabledNotificationsFiles to {"Import To Evernote", "Success Notification", "Failure Notification"}
            register as application ¬
                "Outlook to Evernote" all notifications allNotificationsFiles ¬
                default notifications enabledNotificationsFiles ¬
                icon of application "Evernote"
           
            notify with name ¬
                "Import To Evernote" title ¬
                "Import To Evernote Started" description ¬
                "Now Processing..." application name "Outlook to Evernote" identifier "EVERNOTE"
        end tell
    end if
end Growl_Check

--ANNOUNCE THE COUNT OF TOTAL ITEMS TO EXPORT
on process_Items(itemNum, attNum, the_class)
    set attPlural to "s"
    set app_Path to (path to application "Microsoft Outlook")
    set the_class to the_class as text
    if the_class is "List" then set the_class to "Outlook"
    if the_class is "Incoming Message" then
        set growl_Icon to (path to resource "Mail.icns" in bundle app_Path)
    else if the_class is "Contact" then
        set growl_Icon to (path to resource "vCrd.icns" in bundle app_Path)
    else
        set growl_Icon to (path to resource "lcs.icns" in bundle app_Path)
    end if
    if attNum = 0 then
        set attNum to "No"
    else if attNum is 1 then
        set attPlural to ""
    end if
    tell application "Finder"
        if growl_Running is true then
            set Plural_Test to (itemNum) as number
            if Plural_Test is greater than 1 then
                tell application "Growl"
                    notify with name ¬
                        "Import To Evernote" title ¬
                        "Import To Evernote Started" description "Now Processing " & itemNum & " " & the_class & " Items with " & attNum & ¬
                        " Attachment" & attPlural & "." application name ¬
                        "Outlook to Evernote" identifier "EVERNOTE" image from location growl_Icon
                end tell
            else
                tell application "Growl"
                    notify with name ¬
                        "Import To Evernote" title ¬
                        "Import To Evernote Started" description "Now Processing " & itemNum & " " & the_class & " Item With " & attNum & ¬
                        " Attachment" & attPlural & "." application name ¬
                        "Outlook to Evernote" identifier "EVERNOTE" image from location growl_Icon
                end tell
            end if
        end if
    end tell --FINDER
end process_Items

--GROWL RESULTS
on growl_Growler(growl_Running, successCount)
    if EVnotebook is "" then set EVnotebook to "Default"
    if growl_Running is true then
        tell application "Growl" -- GROWL SUCCESS
            set Plural_Test to (successCount) as number
            if Plural_Test is -1 then
                notify with name ¬
                    "Failure Notification" title ¬
                    "Import Failure" description "No Items Selected In Outlook!" application name ¬
                    "Outlook to Evernote"
            else if Plural_Test is 0 then
                notify with name ¬
                    "Failure Notification" title ¬
                    "Import Failure" description "No Items Exported From Outlook!" application name ¬
                    "Outlook to Evernote"
            else if Plural_Test is equal to 1 then
                notify with name ¬
                    "Success Notification" title ¬
                    "Import Success" description "Successfully Exported " & itemNum & ¬
                    " Item to the " & EVnotebook & " Notebook in Evernote" application name ¬
                    "Outlook to Evernote"
            else if Plural_Test is greater than 1 then
                notify with name ¬
                    "Success Notification" title ¬
                    "Import Success" description "Successfully Exported " & itemNum & ¬
                    " Items to the " & EVnotebook & " Notebook in Evernote" application name ¬
                    "Outlook to Evernote"
            end if
        end tell
        set itemNum to "0"
        set EVnotebook to ""
    end if
end growl_Growler

(*
======================================
// TEMPLATE SUBROUTINES
======================================
*)

on make_Template(l_1, l_2, l_3, l_4, l_5, r_1, r_2, r_3, r_4, the_notes)
    --MAKE TASK TEMPLATE
    set the_Template to "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/></head><body><table BGCOLOR=\"#36454F\" border=\"1\" width=\"100%\" cellspacing=\"2\" cellpadding=\"1\">
<tbody>
<tr BGCOLOR=\"#ffffff\">
<td align=\"center\" ><font color=\"#424242\"><h4><strong>  "
& l_1 & "</strong></h4>  </td>
<td align=\"center\"  ><h4>"
& r_1 & "</h4></td>
</tr>

<tr BGCOLOR=\"#ffffff\">
<td align=\"center\" ><font color=\"#424242\"><h4><strong>  "
& l_2 & "</strong></h4>  </td>
<td align=\"center\" ><h4><strong>"
& r_2 & "</strong></h4></td>
</tr>

<tr BGCOLOR=\"#ffffff\">
<td align=\"center\" ><font color=\"#424242\"><h4><strong>  "
& l_3 & "</strong></h4></td>
<td align=\"center\" ><h4>"
& r_3 & "</h4></td>
</tr>

<tr BGCOLOR=\"#ffffff\">
<td align=\"center\" ><font color=\"#424242\"><h4><strong>  "
& l_4 & "</strong></h4></td>
<td align=\"center\" ><h4> "
& r_4 & "</h4></td>
</tr>
</tbody>
</table>
<hr />
<table border=\"1\" width=\"100%\" cellspacing=\"10\" cellpadding=\"10\">
<tbody>
<strong>"
& l_5 & "</strong><br /><br />" & the_notes & "</tbody></table></body></html>"
end make_Template

92 Responses to “Outlook 2011 To Evernote”

  1. GrantC says:

    Hi,

    Thanks for the script, very useful. Have noticed that even though I set the user defined notebook, emails where still getting sent to my default notebook. Think it’s the set notebook =”" in the Growl Results procedure that causes the problem.

    Also, I get an “attachement parameter file does not exist” when sending an email which has another email as an attachment (and that email had a CSV file attached), not sure what caused the problem though.

    Keep up the good work.

    • Justin says:

      Grant — Thanks for the kind comments!

      I’m currently testing a different approach to Growl with some other scripts and, once I develop confidence that it’s solid, I intend to merge it into this one. When I do, I’ll see about this notebook issue as well.

      As far as the “attachment parameter error”, the Veritrope Bug Report Form allows you to upload files for me to look at — in this case, you can attach the problem email and I’ll use it to test future revisions.

      • Alex says:

        Hello. I am trying to find an app that will allow me in one go to move my 300 notes from Outlook 2011 (Mac edition) to my Evernote account. I don’t want to synchronize between outlook and evernote, simply to move them over (ex blackberry user moving to android). I am very willing to make a generous donation if your app does this and you can assist me.
        Many thanks.

  2. Hans says:

    Great script, thanks,

    How do I modify the scripts so that I can change the title, i.e. add another text field in the dialog box with the email subject pre-populated? I find that I quite often change the title to make it easier to search on or to add work notes.

    Cheers,

    • Justin says:

      I haven’t tested this, but you could add code like this right before Evernote creates the new item:

      display dialog "Set The Note Title" default answer EVTitle
      set dialogresult to the result
      set EVTitle to text returned of dialogresult

      FYI — I can be hired to customize scripts if you get into a jam!

  3. Floyd says:

    Wow! What a great script! Looks like you did a lot of great work — thanks for this.

    I was wondering if there’s a way to add the “to” and “cc” to the header list. That way, I can search on stuff where a friend also received the message.

    Regards to your great skill,

    - Floyd -

    • Justin says:

      Floyd,

      Thanks for the kind comments and for your donation. These scripts really do take a lot of work and it means a lot to me when people recognize the amount of time and effort that go into it.

      I’ve emailed you a modified copy that adds the To: and CC: information — hope you enjoy it!

  4. Sandy says:

    how do i actually download the script? is there a file?

    • Justin says:

      Hi Sandy — There is a button below the code that says “Want to open the script right away? Click here to open it in your Script Editor”. It should open up the script in the AppleScript Editor and, from there, you can save it wherever you like!

      • Sandy says:

        ok i was save the script, but when i click the email to export, it just sends text of some link, or something else. doesn’t actually copy the note over.

        • Justin says:

          Hi Sandy,

          Have you:

          1. Saved this script to ~/Documents/Microsoft User Data/Outlook Script Menu Items?
          2. Saved it with a file name like“Send to Evernote\mE.scpt” which lets you press ⌘E to send items to Evernote?
          3. Highlighted the message and then triggered the script with the keyboard shortcut?

          If that doesn’t get you working, let me know and we’ll go from there!

        • Sandy says:

          ok, when i click on the script icon in Outlook, it will actually move the email over. I saved the file the same way you did, and for some reason i get error when i try the shortcut…any suggestions?

  5. Steve Nunez says:

    Just tried this script, but it doesn’t compile in the AppleScript editor on Lion. The error is a syntax error: “Expected “given”, “into”, “with”, “without”, other parameter name, etc. but found “””.”

    • Justin says:

      This is a common error in versions of Outlook 2011 < 14.1.0…

      I am running Lion 10.7.2 / Outlook 14.1.2 / and Evernote 3.03b2 — script is still working for me!

      • Steve Nunez says:

        Lion 10.7.2 / Outlook 14.1.3 / Evernote 3.0.2 — and still broken.

        • Justin says:

          Looks like *I* am the one who needs the Outlook update! ;)

          Speaking of updates, I’m wondering if this has to do with the latest GROWL 1.3 update that just came out… Is this the version you’re running? If so, try doing a Find-and Replace for “GrowlHelperApp” in the script — changing it to “Growl”.

          Does the script compile now?

          • Steve Nunez says:

            Possibly. I’m not running Growl at all, and one of the Outlook -> Omnifocus scripts broke because of that (despite having a flag for Growl support or not).

            • Justin says:

              My guess is a lack of GROWL.

              Doing GROWL notifications via AppleScript is great — especially when you’re doing a “Bulk” send of a lot of stuff in the background. The problem is that AppleScript is really fussy about when people *don’t* have it. You can check out this excellent post by Dan Byler to see what a pain it’s been to deal with. The new version has a new way of doing things, and so many of us in the AppleScript community are still trying to sort out what this means for our existing scripts. Stay tuned on that….

              If you’re not opposed to GROWL, probably the easiest fix here is to install it. The new version is available at the App Store, but the older, free version is also still available as of this moment.

              Hope this helps!

  6. Lars says:

    Hi, thanks for that tool, i find it very usefull.

    Exporting Emails works fine, tasks as well, but I have a problem with the contact data.

    trying to export my outlook contacts i get a “failed to export”, every attachment of item 1 of contact id 163 couldn’t be read… didn’t manage to export a contact yet.

    do you have any advise on that?

    Thanks a lot, Lars

    • Justin says:

      Hi Lars,

      I was able to reproduce this error and I just updated the code to Version 0.99 (see above) with what I hope is a fix…

      Working for you now?

  7. Thomas says:

    I love this script – excellently done!

  8. Sandy says:

    i noticed that you updated the script. I tried to save it and it keeps giving me “syntax error”. Help?

  9. Hi,

    After updating my Outlook to 14.1.0 everything works like clockwork! Excellent!

    I have made a (modest but well-meant) donation and urge everyone to do the same: efforts like this should be rewarded.

    Warm regards,

    Bard

  10. Jim says:

    MacOS 10.7.2
    Outlook 14.1.4
    Growl 1.2.2
    Send to Evernote VERSION 0.99 (Beta 3)

    As soon as download to Applescript Editor get error Syntax Error “Expected “given”, “into”, “with”, “without”, other parameter name, etc. but found “””.”

    Saved the .scpt file to the outlook script directory anyway. Does not show in the AppleScripts for Outlook pulldown – when I open the folder, the scpt file is there. Presume above syntax error, which prevents it from compiling, is a show stopper?

    Any assistance appreciated.
    Cheers, Jim

  11. Ed says:

    Awesome! This solves a very real problem I am having in trying to replicate the meeting notes capabilities of onenote.

    Would it be difficult to send the same information to an outlook note? And, is there a way to file that outlook note in my email directory without having to email it to myself?

    Thanks.

    -Ed

    • Justin says:

      Hi Ed — And thanks for the donation! :-D

      I’m not sure about placing a note into your email directory, but I think you should be able to adapt this code to create an Outlook Note from a Meeting using AppleScript.

  12. Gazelle says:

    Thank you for making this script. I tried using outlook with my gmail account for a while, but it wasn’t working very well so now I’m using Sparrow Lite. I was wondering if you have a similar script for Sparrow Lite to push emails to evernote or if this script you posted can be edited to do so. I’m new to this script thing.

  13. Eric says:

    Pretty slick

  14. Lemont says:

    Is there any way to send without the attachement?

  15. Jim Dryfoos says:

    FYI, in my case when I upgraded to SP2, I did indeed find the script missing from the folder. However, I also found the Microsoft didn’t wipe out the old folder/scripts, but instead is using a different directory. With SP1 it was using:

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

    After upgrade to SP2, it is now using:

    ~/Library/Application Support/Microsoft/Office/Outlook Script Menu Items

    I was able to copy my previous scr file from the older subdir to the new and it works again :-)

    Cheers, Jim

  16. John says:

    I love the script! Thanks. Is there a way to attach the email to the Evernote note?

    • Justin says:

      Thanks John!

      I’ll take a look when I’m ready to do the next revision of the script. If it’s possible, I think that would make a great addition for a “Switch” you could turn on (emails with attachments can take up a lot of file space, so not everyone would want to do that).

  17. sergio says:

    Hello, I love your script. Any plans to switch from Growl to native OS X notification center or make it an option?

    • Justin says:

      I do plan to make a whole series of update (including notification Center improvements), hopefully in the not so distant future!

      • Ed says:

        That’s great, Justin, that you are planning an update. Your work is hugely useful to me at work. My use is almost exclusively highlighting a meeting in outlook, doing a command-E to get the meeting information into evernote, and then taking my meeting notes in evernote. I use this up to a dozen times a day.

        A couple requests, if you don’t mind.

        It would be great to have an option to avoid the html boxes around the meeting information. I used to hand-edit your work to remove this and make the meeting information much more condensed, but I find myself too busy to do that after the latest release. Another are I would like to condense is the list of attendees. A simple comma separated list would be great. I also eliminated the ics attachment, but included all the others, moved the hrule to separate the content from the notes and added the heading “My Notes:”. I’d be happy to send you my changes to the earlier version if you were interested.

        -Ed

        Here’s what I had, colon aligned:

        Event: Root Cause – April 6th COS Outage
        Start Time: Tuesday, May 8, 2012 1:30:00 PM
        End Time: Tuesday, May 8, 2012 2:00:00 PM
        Location: CONFJAX03A
        Invited: Smith, Tony; Smith, Satyen; Smith, Guruprasanna; Smith, Sharada; Smith, Ed; Smith, Kevin;
        When: Tuesday, May 08, 2012 1:30 PM-2:00 PM (UTC-05:00) Eastern Time (US & Canada).
        Where: CONFJAX03A

        Note: The GMT offset above does not reflect daylight saving time adjustments.

        *~*~*~*~*~*~*~*~*~*

        My Notes:

        Whatever my meeting notes were for this meeting. The information has been redacted to protect the guilty :-) .

        • Justin says:

          Hi Ed!

          Thanks so much for the kind words and for letting me know these types of scripts are helpful to you.

          As someone who has written many customized scripts for clients, it’s sometimes hard for me to go the other direction and write a “One Size, Fits All” version that will be useful to most people. I appreciate your suggestions and I’m going to keep it in mind as I revise the script in the future.

          My tendency, though, would be to try and find a easier way for people to customize their own scripts. I have some ideas about how to do this and it’s something I’ll play around with to see if I can find an improvement to the current way of doing things.

          Thanks again for your support, Ed — I really appreciate it!
          Justin

  18. revfisk says:

    Great stuff Justin. A real help. One question: with only blogger level html understanding, how would I remove the part of script which include the customizable note template? I would like to just send the email content itself, without any of the other informatio, which, personally, clogs up my workflow. Is as easy as cutting a section? Can you tell me where to start and stop my cut? Or, where to put “off” in the code? I skimmed through it all but nothing looked clear enough for this rookie hack.

    • Justin says:

      Hey there (and thanks!),

      Right now, I think the code is too intertwined with the script for me to feel comfortable trying to perform an HTML-ectomy in a comment thread. As I mentioned in the comment above, it’s often hard to write a “One Size, Fits All” version that will be useful to most people. When I revise the script in the future, I am going to try and find a easier way for people to customize their own scripts (an “OFF” switch or something). I am also hard at work at giving Veritrope.com users some better tools to collaborate on / create their own versions of the scripts here.

      Sorry that I don’t have an immediate fix, but — believe me — I hear you! :-)

  19. CBH says:

    Hi there. Have been trying to use the script in Mountain Lion with Outlook 2011 and Evernote Version 3.3.1, with no success so far. The following error message appear:

    Failed to export
    Item” due to the following error:
    La variable selectedItems no está definida.

    Any thoughts?

  20. Kara M. says:

    Hi Justin. I added the script and successfully utilized it three days ago. However, last night, I as moving several things from Outlook to Evernote. I got the Growl notifications like normal that import had started and then that import had been successful, however, the notes aren’t in Evernote – even after syncing repeatedly. Any idea what’s going on. I have the script set up without any of the customization so everything is supposed to just go to my default notebook which is called 1.Inbox (which was appearing properly in the growl notification.

    • Justin says:

      Hi Kara,

      I’m guessing that this is a known issue with some recent changes in Evernote and, because of that, almost all my Evernote scripts aren’t 100% right now.:-(

      Have been hoping to find some work-arounds, but my time has been pretty limited these days. Check back or follow on Twitter to get updates as they occur!

      • Garnet says:

        I am new to organiztion system on http://www.thesecretweapon.org and I could really use this script that you have made. I bought Growl from the Apple Store, and I have Outlook 2011 SP2, and got your script in the right location to show up on the scripts menu, but when I run the script, your script’s dialog box popups to get notebook name from my list of notebooks, but when I click the send, nothing happens, I never get a new note in my evernote.

        I hope you can find time to fix this. I would try to fix it, but I have very little AppleScript experience.

      • Kara says:

        Justin,

        Just wanted to say thanks. I installed the 1/15 code update and everything seems to be working again.

        Kara

  21. Tobias says:

    I installed the script and communication with Evernote works when I hit Command-E (that is I can select a different Notebook for creating the Note). However, on trying to clip an email to Evernote, Growl spits out the Import Error message that the classEVdd of missing value cannot be put as “date ” “”. My system language is German.

    • Justin says:

      I’m wondering if the date formatting on your system is causing the script to fail. Could you change to US/English and see if the script works? If so, I’ll take a look at making the date code work better across different system languages/formats.

  22. Eric says:

    I am also having issues with the compile error for this script:

    SYNTAX ERROR
    Expected “given”, “into”, “with”, “without”, other parameter name, etc. but found “‘”.

    I am using the following:
    Outlook 2011: 14.2.5
    Evernote: 5.0.4

    Thanks for any help!

    Best Regards,
    Eric

    • Justin says:

      It’s possible that you are missing GROWL but, if you have it installed and are still getting a compile error, try cutting-and-pasting the source into your AppleScript editor.

  23. Dan Kraus says:

    Hi Justin, I have followed all the above. Outlook is 14.2, growl is 2.0.1. The Script runs when I click on it at the finder level, but I cannot get the shortcut key to work. It is titled the way you did in the comments. I saved it both as an application and as a script with the \mE switch in the name
    ( Send to Evernote\mE.scpt). So any idea on what I am doing wrong here? Running OSX 10.8.2

    • Justin says:

      Hi Dan,

      Sorry for the belated response-I’ve been traveling quite a bit in recent weeks!

      Generally, shortcuts that don’t work indicate a conflict with an existing shortcut. I would recommend trying some different ones to see if that resolves the issue. Also, I have heard that a system restart can sometimes “flush out” the script menu in certain applications.

      Wishing you the best of luck! :-)

  24. Michael says:

    First off:

    Thank you so much for doing this, the script really helps me a lot!

    Just got one problem left:

    When importing emails from Outlook (got tagging switched ON) it only imports the first tag, the ones added after the first comma are gone (each one seperated by a comma with no space inbetween).

    What could cause this?

    Evernote Version 5.0.4 (400702)
    Outlook for mac 2011 Version 14.2.5 (121010)
    Growl 2.0.1

    Best regards,
    Michael

    • Justin says:

      I think this can happen if you put a space after the comma in a series of tags. (e.g., “One, two, three” and not “One,two,three)

      I will look at adding some code to strip the “leading spaces” from tags in a series – but you can try that now to see if that fixes the problem for you in the meantime!

  25. Amon says:

    Very slick. Ran into a couple errors i seemed to have made go away with a reboot < no – this is a Mac – not windows :-)

    I may have misunderstand the functionality, but from what i read i'm expecting a dialogue box to appear to allow me to select the notebook and add tags? I set the following like so:

    property tagging_Switch : ""

    Is that correct?

    Thanks for the awesome script.

    • Amon says:

      Not sure why i didn’t try this before posting, but setting explicitly to “ON” seemed to do the trick. Again – thank you for this!!!!

  26. Jenny says:

    I have saved the script and it is working. However, I can not get the shortcut to work. So, the only way I can transfer outlook to evernote is if I highlight an item in outlook and then hit run on my script. Is there a trick I’ve missed?

    • Justin says:

      Hi Jenny,

      I’ve heard that the shortcut I suggest (and use myself) doesn’t work on some people’s computers, presumably due to a conflict with another shortcut. I’d suggest trying to change the shortcut to something else to see if that gets things going.

      Good luck! :-D

  27. Brian says:

    Thanks very much for this script. I’m unfortunately experience the same Syntax error with AppleScript that others have mentioned and haven’t been able to get past it. When I try to save the script, the Syntax Error dialog appears with the error: “Expected “,” but found property.”

    I am running OSX 10.7.5 with Growl 2.0.1 and Outlook 2011. I have tried restarting, as well as copy and pasting the code directly into AppleScript. Any ideas how to fix this?

    Many thanks for your help

    • Justin says:

      Hi Brian,

      A bit of a head scratcher — Wondering if it could be a browser/plug-in issue doing something like changing the quotation marks in the code…

      I’d try clicking the link in a different browser to see if that does the trick. If not, let me know via the Bug Reporter and I’ll email you a copy of the script which compiles on my system!

      • Brian says:

        Hi Justin,

        Many thanks for the quick response. I think it may be a problem with my version of Outlook. I thought I was updated but turns out I am running version 14.0.0. Would that be the issue? If so, is there a modification to the code that would allow it to work with this version, or do I need to upgrade?

        Thanks again.

        • Brian says:

          Hi Justin, wanted to follow up to let you know that I updated outlook and everything seems to be working fine now. Thanks a million.

  28. Sergio says:

    Hi Justin, any word on uncoupling this script from its Growl requirement? I’d like to not have to install growl for this one script when I use notification center for everything else.

    Thanks!

    • Justin says:

      Hi Sergio,

      I’m still thinking through how I want to do notifications…

      The great thing about AppleScript, though, is that it’s not too hard to read through the code and edit/tweak to make things suit your particular needs or workflow.

      With a little trial and error, I think you should be able to find and edit out all the Growl portions of the script. Who knows — It could kickstart a whole bunch of AppleScripting for you! ;-)

  29. John says:

    script does not compile, error messages all over. for example.

    set account_Info to (properties of account info 1)

    expected “,” but found identifier

    • Justin says:

      Hi John — I’m seeing reports of a couple of new Evernote / AppleScript errors, one of which involves scripts not compiling if Evernote isn’t running.

      You may want to double-check that Evernote is open and try again to see if that gets you going. If not, you can use the Bug Report button on this page to send me some more details.

  30. Al says:

    I love using the script. But, there is one problem that I can’t seem to figure out. (This is my first time using applescript ) The script works fine for me only if I have both Outlook and applescript open and click on “Run” in applescript. But I don’t know how to copy the script into the Outlook applescript folder. My applesscript does not give the option for “save as” . . . only “save”. I’m new at this and just cant seem to get the file saved. Thanks for your help.

    • Justin says:

      Hi Al,

      So to make sure I understand what’s happening – When you select ‘Save’, you aren’t given the dialog box which lets you select the location to save the file?

      • Al says:

        Justin . . . it’s working! I’m not certain what I was doing wrong, nor what I did right to fix it. But, the good news is that it’s up and running. Thanks so much for sharing your expertise!

  31. I’m very interested in using this and using this, but was wondering if you were going to update the script to use the built-in Mountain Lion Notification Center instead of Growl.

    • Justin says:

      Hi Tim,

      As far as I know, currently there’s no way to send messages from AppleScript to Notification Center with installing additional packages. (GROWL lets you forward to N.C., as does a CLI app called ‘terminal-notifier’).

      If things change, I’m on it. ;-)

      • Thanks, Justin. I had seen that someone created an Automator action that would let you post to notification center. It says its specifically for use in Automator “workflows” and I tried it in an “app” that uses a shell script and it didn’t work. I didn’t try very long to troubleshoot it though. Its here: http://www.automatedworkflows.com/2012/08/26/display-notification-center-alert-automator-action-1-0-0/

        Also, I managed to update your script to remove Growl notifications. I am getting an error about the temp directory not existing which maybe I caused or maybe I didn’t (I didn’t touch the trash routines). What I did was just have the script open the newly created notes in individual Evernote windows when its done creating them. I’d be happy to give it back to you if you want, although all I did was comment out all the Growl code rather than elegantly let you specify whether you want to use Growl or not.

  32. Matt says:

    Absolutely love this script, thanks so much for creating it, will donate in a mo!

  33. Andre Baruch says:

    Hi Justin

    A different problem
    I just downloaded the script, and the newest version of Growl (2.0.1)

    The script works (nicely too, thanks!)
    BUT, for it to work I have to open the script in the script editor and manually run it The suggested keyboard shortcut (Command E) doesn’t work.

    The scipt is saved as Send to Evernote\mE.scpt in the correct location (Documents / Microsoft User Data / Outlook Script Items).

    Any ideas on what silly step I missed as to why this doesn’t work? The links on your page here all suggest that this is the correct file ending to enable the keyboard shortcuts.

    Your assistance is greatly appreciated.

    Kind regards

    Andre Baruch

    • Justin Lancy says:

      Ahh… the mysteries of Outlook’s keyboard shortcuts! ;-)

      In all likelihood, it’s a conflict with another shortcut on your system. Since every system is different, it would be hard for me to say exactly what is causing the issue on your particular system.

      I would recommend a little trial and error, changing the letter or the modifier key for the shortcut until it works. Good luck!

  34. Matt says:

    Hey Justin- I’m a complete newbie with this Mac stuff, but have been using Evernote for years. I ran across this awesome page yesterday and tried the script. After some initial issues due to user error, it worked perfectly…until just a few minutes ago for some reason. I now get the Syntax Error- ‘Expected “,” but found identifier.’ I haven’t changed anything. Any words of wisdom?

    • Justin Lancy says:

      Hi Matt,

      Perhaps it’s a new-ish bug with Evernote – Many people are reporting that Evernote AppleScripts aren’t working unless the application is already running… I’d try opening Evernote first and then retrying.

      Does that get you going again?

  35. Tim says:

    Justin,
    Great script, using it a lot. One question I have for recurring Outlook meetings. The script is grabbing the creation date of the meeting (original invite) when moving it into Evernote, it would be great to use the date of the meeting you have in context for the start dt/tm. Thanks for your work.

rss Subscribe to Comments RSS Feed


You can use these tags in your comment: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>