The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Clip-o-Tron from Mail rule? (http://forums.omnigroup.com/showthread.php?t=12591)

grichar1 2009-05-21 08:06 AM

Clip-o-Tron from Mail rule?
 
Context:
Overwhelmed AppleMail Inbox
MailTags 2.2.3
Mail Act-On 2.0.5

I've done a cursory search of the extensive forum discussion regarding moving mail from Apple Mail to OF and cannot find an answer to what I hope is probably a simple question: Is there a way to invoke the Clip-o-Tron from within a Mail rule? Alternatively, is there a script out there that replicates the Clip-o-Tron functionality more completely than OF's mail action script?

Specifically, I need to be able to automatically process certain emails (file, change the status of parent emails, add MailTag projects etc. and send them to OF 1) with their attachments (if present) and 2) auto-assigning the project. Clip-O-Tron accomplishes these latter two goals, but the OF mail action rule (and Curt Clifton's older mail-to-OF scripts, dug out of his archive) do not. I'm a scripting simpleton, so doing this myself is pretty much out of the question. (Might be fun to learn, but that pretty much defeats the whole GTD reason for working this hard to streamline the workflow.)

Any idea?

connie 2009-05-22 11:10 AM

I have the same questions.... thanks

Lucas 2009-05-25 12:02 PM

When you activate the clip-o-tron, it sets up a mail rule for its activation.
You can add other Mail actions to be performed when it is activated.

grichar1 2009-05-26 10:14 AM

[QUOTE=Lucas;60297]When you activate the clip-o-tron, it sets up a mail rule for its activation.
You can add other Mail actions to be performed when it is activated.[/QUOTE]

Where can I find the rule? It's not in the Mail Rule listings. I've tried removing the Clip-o-Tron, restarting Mail, restarting OF, then enabling the Clip-o-Tron and repeating the process. Can't find it.

Ken Case 2009-05-27 02:05 PM

[QUOTE=grichar1;60142]Is there a way to invoke the Clip-o-Tron from within a Mail rule?[/QUOTE]

The only way I can think of would be to use UI scripting to click on the Clip-O-Tron's menu item:

[CODE]activate application "Mail"
tell application "System Events"
tell process "Mail"
click menu item "OmniFocus: Send to Inbox" of menu 1 of menu item "Services" of menu 1 of menu bar item "Mail" of menu bar 1
end tell
end tell[/CODE]

I'm not sure if that works from a Mail rule or not; presumably you'd want to make sure the message was selected in the frontmost viewer before you invoke the clipping service.

[QUOTE]Alternatively, is there a script out there that replicates the Clip-o-Tron functionality more completely than OF's mail action script?

Specifically, I need to be able to automatically process certain emails (file, change the status of parent emails, add MailTag projects etc. and send them to OF 1) with their attachments (if present) and 2) auto-assigning the project.[/QUOTE]

Unfortunately, AppleScript doesn't really support rich text with embedded attachments (such as inline images): that's why we wrote the Clip-O-Tron using pasteboard services (augmented with AppleScript) rather than simply using AppleScript by itself.

(I'm not quite sure what you mean by "auto-assigning the project"; it's definitely possible to look up projects and assign them to tasks you create from AppleScript, and I think there are some examples posted which do this.)

grichar1 2009-05-28 08:22 AM

[QUOTE=Ken Case;60456]The only way I can think of would be to use UI scripting to click on the Clip-O-Tron's menu item:[/QUOTE]

Thanks for looking at this, Ken. I never would've thought to use the UI. The script you wrote works great from the script editor, and it's actually pretty quick (UI scripts I've used in other contexts run pretty slow). But your intuition is correct; it doesn't work from within a Mail rule. The UI references get lost somehow, even when I expressly tell System Events to put mail frontmost. There's nothing useful in the Console-- the commands just disappear.



[QUOTE=Ken Case;60456](I'm not quite sure what you mean by "auto-assigning the project"; it's definitely possible to look up projects and assign them to tasks you create from AppleScript, and I think there are some examples posted which do this.)[/QUOTE]

For reference, I was referring to the ability Clip-O-Tron has to use a MailTags Project name, if present and equal to an OF project name, as the project of the new task. I can't find this functionality in any of the scripts, current or past, for moving mail to OF. I had another look at the scripts included in this Forum and couldn't find anything. If you know of one I could use as a template, please let me know.

Thanks again for looking.

Ken Case 2009-05-29 06:31 AM

[QUOTE=grichar1;60494]For reference, I was referring to the ability Clip-O-Tron has to use a MailTags Project name, if present and equal to an OF project name, as the project of the new task. I can't find this functionality in any of the scripts, current or past, for moving mail to OF. I had another look at the scripts included in this Forum and couldn't find anything. If you know of one I could use as a template, please let me know.[/QUOTE]

Inside the OmniFocus app itself you'll find the AppleScript code used to handle clipping from MailTags, in OmniFocus.app/Contents/PlugIns/BuiltInClippingHandlers.plugin/Contents/Resources/Mail-with-MailTags.applescript.

Here are the relevant excerpts:

[CODE]using terms from application "MailTagsScriptingSupport"
set MyProjectName to project
end using terms from

tell MyTask
set MyProject to missing value
try
if MyProjectName is not missing value then -- will raise if the value is undefined/null
tell containing document
set MyPossibleProjects to complete MyProjectName as project maximum matches 1
if (count of MyPossibleProjects) is not 0 then
set MyProjectID to (id of item 1 of MyPossibleProjects)
set MyProject to project id MyProjectID
end if
end tell
end if
end try
end tell
[/CODE]

There are a number of other scripts bundled inside OmniFocus.app which might be useful reference material:

[CODE]% find OmniFocus.app -name '*.applescript'
OmniFocus.app/Contents/PlugIns/BuiltInClippingHandlers.plugin/Contents/Resources/Default.applescript
OmniFocus.app/Contents/PlugIns/BuiltInClippingHandlers.plugin/Contents/Resources/Finder.applescript
OmniFocus.app/Contents/PlugIns/BuiltInClippingHandlers.plugin/Contents/Resources/Mail-Leopard.applescript
OmniFocus.app/Contents/PlugIns/BuiltInClippingHandlers.plugin/Contents/Resources/Mail-with-MailTags.applescript
OmniFocus.app/Contents/PlugIns/BuiltInClippingHandlers.plugin/Contents/Resources/NetNewsWire.applescript
OmniFocus.app/Contents/PlugIns/BuiltInClippingHandlers.plugin/Contents/Resources/OmniPlan.applescript
OmniFocus.app/Contents/PlugIns/BuiltInClippingHandlers.plugin/Contents/Resources/OmniWeb.applescript
OmniFocus.app/Contents/PlugIns/BuiltInClippingHandlers.plugin/Contents/Resources/Safari.applescript
OmniFocus.app/Contents/Resources/MailAction.applescript
OmniFocus.app/Contents/Resources/SampleScripts/DumpContextTasks.applescript
OmniFocus.app/Contents/Resources/SampleScripts/Publish to iCal.applescript
OmniFocus.app/Contents/Resources/SampleScripts/Send to OmniFocus.applescript
OmniFocus.app/Contents/Resources/UpdateMailActionInstallation.applescript
[/CODE]

Hope this helps!

villan 2009-06-04 03:57 PM

Interesting thread. I'm trying to do something similar, in that my goal is to have any email I send that is marked with a tickler date, automatically get added to OmniFocus. Between Mail Tags / Mail Act On / Omnifocus, all the parts seem to exist, it's just a matter of getting them to play together.

johnrover 2011-06-20 09:48 AM

Was anyone ever able to cobble together a working solution for this?


All times are GMT -8. The time now is 09:22 PM.

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