Make it an Automator service, give it a keyboard shortcut, and get to Inbox Zero faster than ever!
-- Archive behaviour found at: http://vemedio.com/blog/posts/my-archive-email-apple-script
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 my_subject to the subject of the selected_message
set message_url to "message://%3c" & message_id & "%3e"
set _mb to mailbox of selected_message
set _acct to account of _mb
set _archive_box to _acct's mailbox "Archive"
tell application "OmniFocus"
tell quick entry
make new inbox task with properties {name:my_subject, note:message_url}
open
end tell
-- tab into subject pane
tell application "System Events"
keystroke tab
end tell
end tell
move selected_message to _archive_box
end tell
I am completely useless for Automator it seems, cannot get your most interesting script to work. Could you please give me a description of how to save your script? I use launchbar to access scripts and services normally.
Thanks a lot for that, I ended up saving it in the script editor for now, though. I was on the verge of giving up OF2-testing for now, lacking that functionality.
I’ve had a play with my script, and would ideally like to have the url (to quickly get back to the message) and the text of the e-mail (my_body) in the note. I can change it so I get one or the other, but not both.
Is that possible? I’ve also removed the archive routine, as I like to file the mail
Thanks for the script. Is it possible to adjust it so that multiple messages and/or conversations can be selected in Mail and then links to all messages included in the Notes field?
Here’s my final script from Automator. The link back to the original e-mail doesn’t always work, if you’ve moved it from the original location, but I didn’t want everything dumping in an Archive folder.
[quote]
on run {input, parameters}
-- Send currently selected Mail.app message to OmniFocus 2 quick entry box, then archive it
-- Archive behaviour found at: http://vemedio.com/blog/posts/my-archive-email-apple-script
tell application "Mail"
set theSelectedMessages to selection
set the selected_message to item 1 ¬
of the theSelectedMessages
set my_body to the content of the selected_message
set message_id to the message id of the selected_message
set my_subject to the subject of the selected_message
set message_url to "message://%3c" & message_id & "%3e"
set _mb to mailbox of selected_message
set _acct to account of _mb
tell application "OmniFocus"
tell quick entry
make new inbox task with properties {name:my_subject, note:message_url & my_body}
open
end tell
-- tab into subject pane
tell application "System Events"
keystroke tab
end tell
end tell
end tell
return input
When i run the script for a selected Exchange mail message using Mail.app, the linkback to the message does not work.
Comparing the message id from this script and another script that gets the last message sent, i can see that the url’s are different. Any idea how to make this work with this script?
Link using your script: message://%3cCF8926EB.B131%mjo@nema.fo%3E
Link using different script where link back works: message://%3C8D63352D-9A4C-4C08-998E-0B247D14910A%40nema.fo%3E
so I’m 99% sure this is a dumb question, but that’s never stopped me before so why stop now?
Why use this script when you could just clip the email. Only thing I see this script do that clipping doesn’t is move it to an archive folder. But that’s ok as I use Mail Act On to move it to an @Action folder instead.
Just not seeing what this script does that I can’t already do with built in clipping functionality.
It archives the email and lets you move on with processing the next email without leaving your mail client, which is something clipping doesn’t do. Additionally, not everyone uses or wants to use Mail Act On.
It’s worth noting that if you don’t want to use it no-one is forcing you - I’m glad you have a working process with Mail ActOn!