Create a Things To-Do from MS Outlook with a Link Back to the Email

I'm a big fan of using Things by Cultured Code as my To-Do manager, as it's very easy to use and allows for the quick creation and management of my To-Dos.

Since I work almost exclusively off my email in Microsoft Outlook at work, I've created an AppleScript that I've assigned to a hotkey in BetterTouchTool that will automatically generate a new Things To-Do from the selected email.

Once my To-Do is complete, however, it's annoying to go back into MS Outlook to find the email that I was referencing, so that I can respond to it.

To solve this problem, I've added a link to each of these To Do's with a custom URL handler that directs me back to the MS Outlook email that I created the To Do from. The email link that is created in the To Do looks like this

outlookemailopener://2019-05-13%2003:07:17%20+0000/My%20Email%20Subject/[email protected]

I've written a separate AppleScript, that I've saved as an App and modified the info.plist file to register the outlookemailopener handler as the opener for this AppleScript.

<key>CFBundleURLTypes</key><array>    <dict>        <key>CFBundleURLName</key>        <string>Outlook Email Opener</string>        <key>CFBundleURLSchemes</key>        <array>            <string>outlookemailopener</string>        </array>    </dict></array>

The outlookemailopener AppleScript uses a Spotlight query to search for the email file on your Mac and open it in MS Outlook. Because it uses a combination of the email date, subject, and sender, rather than a randomly-generated internal identifier, this script will work across all of your Macs (because each copy of MS Outlook assigns an email a randomly generated identifier).

set searchQuery to "(com_microsoft_outlook_messageSent == $time.iso(" & theDate & ")) && (com_microsoft_outlook_author_email_addresses == \"*" & theEmail & "*\") && (kMDItemTitle == \"" & theSubject & "*\")"set searchCmd to "mdfind '" & searchQuery & "'"

You can find the link to two AppleScripts here.

Bind "Create Things To Do.scpt" to a hotkey that you can press while in MS Outlook to create a Things To-Do.

"Open Outlook" should be picked up by LaunchServices and register the outlookemailopener URL handler.