The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   MailSmith & OmniFocus (http://forums.omnigroup.com/showthread.php?t=6744)

Kane 2008-01-12 08:42 AM

MailSmith & OmniFocus
 
2 Attachment(s)
I have modified the OmniGroup's Mail script to support MailSmith. Attached is a detailed pdf describing the script and how to make it work with MailSmith.

Please read the script itself, as I have modified it's functionality in two places:
o It does not include the contents of the message as part of a task (my workplace appends a disclaimer to each message, which was being included)

o It also does not filter based on an allowed sender list, although if you leave on the "OmniFocus:Preferences:Mail:Add Mail Rule to create OmniFocus actions" check box, you can uncomment this section to activate it.

Please let me know of any problems you may encounter with this, and enjoy:-)

Jeffrey

--- NOTE - The forum won't allow me to post the pdf with pictures (it's 157kb), so I am enclosing the text portion and the pictures will be posted separately


- Create the following script using Script Debugger or Script Editor
- -- Copyright 2007 The Omni Group. All rights reserved.
-- Modified 2008 by Jeffrey Kane for MailSmith 2.1 support,
published with permission
--
-- $Header:
svn+ssh://source.omnigroup.com/Source/svn/Omni/branches/OmniFocus/
1.x/OmniGroup/Applications/Focus/App/Preferences/MailAction.apples
cript 96639 2008-01-01 07:16:24Z bungi $

on process_message(theMessage)
local theSender, trimmedSender, AllowedSender
local theSubject, singleTask, theText

tell application "Mailsmith"
set theSender to address string of originator of theMessage
set theSubject to subject of theMessage
set theContent to content of theMessage
end tell

tell application "OmniFocus"
-- set AllowedSender to allowed mail senders
-- if AllowedSender does not contain theSender then
-- return
-- end if

-- bug in OF - 1/3/2008
-- short circuit this sanity check as OmniFocus doesn't define
"allowed mail senders" unless Mail Support is enabled in the OF
Preference Window
-- if this changes we can uncomment this section
--
end tell


set singleTask to false
if (theSubject starts with "Fwd: ") then
-- Whole forwarded messages shouldn't split.
set singleTask to true
set theSubject to text 6 through -1 of theSubject
end if

set theText to theSubject -- & return & theContent
-- NOTE: commented out the email's content of the messsage, as
some workplace mail senders add a disclaimer to each message
which I didn't want included

tell application "OmniFocus"
tell default document
parse tasks with transport text theText as single task
singleTask
end tell
end tell
end process_message

on FilterMessage(theMessage)
local m, n
try
my process_message(theMessage)
on error m number n
beep 3
display dialog "Exception in MailSmith action: (" & n & ") " & m

tell application "OmniFocus"
log "Exception in MailSmith action: (" & n & ") " & (m as rich
text)
end tell
end try
end FilterMessag

* Save the as script in your MailSmith Mail Actions folder (within your
home account "~/Library/Application Support/Mailsmith Support/Action
Scripts/"):
- Within MailSmith set up a new filter:
- Filter Criteria:
- If Subject Starts With --
- Or To Contains +of@
- Filter Actions:
- Run Script MailAction.scpt
- Transfer OminFocus Items
- I created a new mailbox called "OmniFocus Items" to collect all the
tasks after they have been processed, but you could just as easily
transfer them to the trash
- Attach this filter to your (incoming mail) box
- Open the Window:Filters list in MailSmith
- Open the Window:Mailbox List in MailSmith
- Drag the filter onto your (incoming mail) mail box
- Confirm you have the filter attached by clicking on the downward
facing triangle to the right of the filter name


All times are GMT -8. The time now is 08:57 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.