Thread: I need 'OUT' !
View Single Post
Quote:
Originally Posted by endoftheQ View Post
JohnJ80,

Thank you for taking the time-and-trouble to respond.

I have examined other To Do/GTD products but none offer the industrial strength that OmniFocus has as its core feature. That doesn't stop me getting a touch of the green-eyed monsters at some of the import/export options that other Apps and their desktop equivalents currently offer.

I'd like to ask if you'd be willing to share your script with other users? Just for myself, although I'm guessing it would be true for most of my colleagues, it would be genuinely appreciated.

Thanks.
Sure. Here it is:

tell front document of application "OmniFocus"
-- get the window the user is using
set |w| to first document window whose index is 1
-- find out where we are and if there's anything we can do

set theItems to selected trees of content of |w|

-- Detect common failure modes and explain

if ((count of theItems) is 0) then
display alert ¬
"Select an action to " & toolName message "You have not selected an action"
return
end if

if ((count of theItems) is greater than 1) then
display alert ¬
"Select just one action to " & toolName message "You have selected more than one item, please select just one"
return
end if

set selectedItem to value of item 1 of theItems

if ((class of selectedItem) is inbox task) then
display alert ¬
"Sorry, action not supported" message "Actions in inbox do not reveal their projects in version " & toolVersion & " of " & toolName
return
end if


if ((class of selectedItem) is not task) then
display alert ¬
"Select an action to email." & "You have selected something that isn't a single action"
return
end if

try
set _dueDate to (get due date of selectedItem as date)
on error
set _dueDate to "None"
end try


try
set _note to (get note of selectedItem)
on error
set _note to ""
end try


try
set _project to the name of (get containing project of selectedItem)
on error
set _project to "None"
end try

try
set _context to the name of (get context of selectedItem)
on error
set _contexct to "None"
end try


try
set _subject to the name of selectedItem
on error
set _subject to "No Subject"
end try



set _body to "Action Item: " & _subject & return
set _body to _body & "Date Due: " & _dueDate & return
set _body to _body & "Project: " & _project & return
set _body to _body & "Context: " & _context & return

set note of selectedItem to ((current date) as string) & " " & "sent followup up email " & return & _note


end tell


tell application "Mail"
set _signature to content of signature 1
set _body to _body & return & _signature
set _id to (get id of (make new outgoing message with properties {subject:"Followup on Action Request:" & _subject, content:_body}))
activate
set win_index to (get index of front window)
set visible of outgoing message 1 to true
end tell

Some of this has been shamelessly copied from other scripts. I apologize for not keeping the author's information available. I also accept no responsiblity that this will work properly, as described or not do heinous damage to your system (in other words, you are on your own with this).

I set this up so it is in the Applecripts menu for Omnifocus. It creates an email with the subject "Followup on Action Request:" I use this to capture the response from a subordinate in a smart mailbox in mail.

I then also have another script that gets the last sent email from my sent items, creates a link which I can then paste into the note field. Clicking this link takes me to the email that was sent.

J.