The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus 1 for Mac
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Send Mail message (with link) to OF Inbox Thread Tools Search this Thread Display Modes
Thought I'd share this applescript that sends the current selected message in Mail to the Inbox. It includes the context of "Mail" and note with a link back to the message.

Be sure you edit the script to change the context to match yours. Also, you must create the context in OF before the script will function.

Here's what I've found as a best practice in using this:

1. Setup a Mail Act-On Rule to run the script and (optionally) move the message to an "actionable" folder.

2. OF will now have an new inbox task with a name based on the subject, sender, and 1 line summary of the email. In the notes field will be the link back to the Mail message.

3. To easily switch directly to that message, Select All in the note field of the task and press your QuickSilver shortcut to "Command Window with Selection". The default action should be "Open URL". Press return and your Mail message opens in a new window.
Attached Files
File Type: zip Send Mail to OmniFocus.zip (3.1 KB, 1483 views)
 
Very cool, thanks for sharing. I've edited the script so that the action created in OmniFocus has no context; that way everything will sit in the Inbox in OmniFocus until I deal with it. (Otherwise, if you click 'Clean Up' and it already has a context assigned, it'll go to that context's lists but not appear in any Project list, which I find very annoying. This way, it'll stay in the Inbox until it's definitely dealt with.)

I also edited it to use em-dashes (—) rather than hyphens (-) between the sections of the action title in OmniFocus. But I know I'm typographically sad.

One thing, though. I don't use Mail Act-On (yet). I copied this script into Mail's scripts folder (~/Library/Scripts/Applications/Mail), but there's no way to activate the script from within Mail itself—it doesn't appear in any of the menus, for example, or on the toolbar. So far I've only run the script from within Script Editor (obviously not a long-term solution, just testing it out). I looked at the DEVONthink scripts in that folder, which do produce items in the 'Message' menu in Mail, but couldn't see anything obvious. Any idea? I'm not an AppleScript maven, I'm afraid.

Thanks very much for this. I was just wondering when we'd see the first OmniFocus AppleScripts!

Richard
 
Hmm...
Code:
The variable new_Context is not defined.
But if I remove the context business as suggested in the previous post, it works. I have changed the script so that the message text appears in the note field (with the url) instead of in the task title (with the sender and subject).

Last edited by Craig; 2007-06-08 at 09:26 AM..
 
Quote:
Originally Posted by zooids
3. To easily switch directly to that message, Select All in the note field of the task and press your QuickSilver shortcut to "Command Window with Selection". The default action should be "Open URL". Press return and your Mail message opens in a new window.
Thanks for the script.

I can't get the link to work either via QuickSilver or by the right-click context menu. Anyone else have this problem? Something I'm not getting?
 
Zooids,

Thanks for posting this! It is fantastic. I hope someone can make it even better.

For the script to work, this line has to reflect the context you are using in OF:

Quote:
set My_Context to "mail"
In other words, you would have to have a top-level context called mail.

I have prefer to use "email" so I changed my script to the following:

Quote:
tell application "Mail"
set theSelectedMessages to selection
set the selected_message to item 1 ¬
of the theSelectedMessages
set message_id to the message id of the selected_message
set message_url to "message://" & message_id
set message_subj to (subject of selected_message)
set message_sender to (extract name from sender of selected_message)
set message_content to summarize (content of selected_message as string) in 1
end tell

tell application "OmniFocus"
set MyDoc to first document
set My_Context to "email"
set My_Task to message_subj & " - " & message_sender & " - " & message_content

tell MyDoc
try
id of My_Context
on error
set new_Context to first context whose name contains My_Context
end try
make new inbox task with properties {name:My_Task, context:new_Context, note:message_url}
end tell
end tell
Note: you need a top level context called email.
 
Quote:
Originally Posted by Richard Flynn
One thing, though. I don't use Mail Act-On (yet). I copied this script into Mail's scripts folder (~/Library/Scripts/Applications/Mail), but there's no way to activate the script from within Mail itself—it doesn't appear in any of the menus, for example, or on the toolbar. So far I've only run the script from within Script Editor (obviously not a long-term solution, just testing it out). I looked at the DEVONthink scripts in that folder, which do produce items in the 'Message' menu in Mail, but couldn't see anything obvious. Any idea? I'm not an AppleScript maven, I'm afraid.
You put the script in the right place, but you need to add the Scripts menu to your menu bar. Here's how (from Mail's help):
Quote:
To add the Script menu to the menu bar, open AppleScript Utility, located in Applications/AppleScript/. Select the “Show Script Menu in menu bar” checkbox. The menu appears on the right side of the menu bar.
 
Quote:
Originally Posted by zooids
Thought I'd share this applescript that sends the current selected message in Mail to the Inbox. It includes the context of "Mail" and note with a link back to the message.
Does the link back require MailTags? Thanks!
 
Quote:
Originally Posted by Richard Flynn
I looked at the DEVONthink scripts in that folder, which do produce items in the 'Message' menu in Mail, but couldn't see anything obvious. Any idea? I'm not an AppleScript maven, I'm afraid.
Richard
The Devonthink applescripts DO show up in the applescript menu. There is a separate Devonthink mail plugin "bundle" that goes in the mail plugins folder that causes that option to show up in the message menu. 2 completely different animals. I would LOVE to see that kind of "plugin" integration.

Also – be aware that placing things in /library/scripts/mail makes things show up system wide in the applescript menu under "mail". Placing things in ~/library/scripts/applications/mail makes things show up in a dynamic applescript menu that only appears when mail is the active application.

Also – run the "applescript utility" in applications/applescript/applescript utility. There are some OS visibility options in there.
 
Quote:
set My_Context to "mail"
What would the syntax be to set the context to a nexted context, ie: @home –> @onLatop –> email?
 
Using quicksilver for the URL bit is very clever. But... It's really cumbersome.

Hey Omni – you are going to add URL support at some point, including "message://", right? Please?
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Send to Inbox" toolbar icon in Mail.app? S. Esch OmniFocus Extras 0 2010-10-18 01:13 AM
Error when you select send mail clipping to Inbox ksrhee OmniFocus 1 for Mac 5 2009-04-22 12:01 PM
Send to Inbox from the message window Ward OmniFocus 1 for Mac 2 2009-03-31 05:51 PM
Link to mail message? JohnJ80 OmniFocus Extras 3 2008-04-21 03:03 PM
"Send to Inbox" is disabled in Mail Ward OmniFocus 1 for Mac 4 2008-01-18 07:17 PM


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


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