You didn't pay for the deluxe version? :-)
Okay, if you really to automate this, this appears to work. Make a new rule in Mail which appears above your existing OmniFocus rule(s). Have it only run on messages sent by iCal, which it appears you can determine by looking to see if the subject begins with "Alarm - ". The rule then runs the following script instead of the one inside the OmniFocus application, and strips away the content of the message before handing it to OmniFocus. It's a trivial change to the OmniFocus version of the script, but you're accepting responsibility for making sure that you track any changes they might make to the original. You could of course replace the original, but that means you have to repeat the process each time you update OmniFocus.
Here's a snapshot of the rule I used to test that the script didn't break any existing functionality (except, of course, the ability to send a message which starts with "Alarm - "!). You could use something like this instead of the rule installed by OmniFocus if you are comfortable that everything still works with this change in place.
The edited version of the script appears below. Make sure you set up your rule to point to wherever you've saved the compiled version.
Code:
-- Copyright 2007 The Omni Group. All rights reserved.
--
-- $Header: svn+ssh://source.omnigroup.com/Source/svn/Omni/branches/OmniFocus/1.9.x/OmniGroup/Applications/OmniFocus/App/Preferences/MailAction.applescript 110059 2009-03-12 04:33:13Z kc $
using terms from application "Mail"
-- Trims "foo <foo@bar.com>" down to "foo@bar.com"
on trim_address(theAddress)
try
set AppleScript's text item delimiters to "<"
set WithoutPrefix to item 2 of theAddress's text items
set AppleScript's text item delimiters to ">"
set MyResult to item 1 of WithoutPrefix's text items
on error
set MyResult to theAddress
end try
set AppleScript's text item delimiters to {""} --> restore delimiters to default value
return MyResult
end trim_address
on process_message(theMessage)
tell application "OmniFocus"
log "OmniFocus calling process_message in MailAction script"
end tell
-- Allow the user to type in the full sender address in case our trimming logic doesn't handle the address they are using.
set theSender to sender of theMessage
set trimmedSender to my trim_address(theSender)
tell application "OmniFocus"
set AllowedSender to allowed mail senders
if AllowedSender does not contain trimmedSender and AllowedSender does not contain theSender then
return
end if
end tell
set theSubject to subject of theMessage
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 & content of theMessage
if (theSubject starts with "Alarm - ") then
-- iCal reminder, strip off unwanted message body
set theText to theSubject & return
end if
tell application "OmniFocus"
tell default document
parse tasks with transport text theText as single task singleTask
end tell
end tell
end process_message
on perform mail action with messages theMessages
try
set theMessageCount to count of theMessages
repeat with theMessageIndex from 1 to theMessageCount
my process_message(item theMessageIndex of theMessages)
end repeat
on error m number n
tell application "OmniFocus"
log "Exception in Mail action: (" & n & ") " & m
end tell
end try
end perform mail action with messages
end using terms from
The added lines are simply:
Code:
if (theSubject starts with "Alarm - ") then
-- iCal reminder, strip off unwanted message body
set theText to theSubject & return
end if