I wrote this to be able to make a list of action items that I can then paste into an email, a document, etc... The way I use this is to use OF to take meeting action items then I can select them all in OF, run this script, and the information is transferred to the clipboard. I can then paste them into an email, into a text file, into a word processor etc....
Use it if it's useful. No claims made on accuracy, effectiveness or the safety of your data. It's just written so no claim on being bug free:
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 _body to "" -- null out text
repeat with cnt from 1 to (count of theItems)
set selectedItem to value of item cnt 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 " & toolName message "You have selected something that isn't an action"
return
end if
try
set _dueDate to (get due date of selectedItem as date)
on error
set _dueDate to "None"
(* set _dueDate to text returned of (display dialog "Please enter data and time xx/xx/xxxx xx:xx AM/PM." default answer (current date) as string)
set _dueDate to _dueDate as date *)
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 _contect to "None"
end try
try
set _subject to the name of selectedItem
on error
set _subect to "No Subject"
end try
set _body to _body & "Action Item: " & _subject & space & return
set _body to _body & "Due by: " & _dueDate & return
set _body to _body & "Project: " & _project & return
set _body to _body & "Who: " & _context & return & return
end repeat
end tell
set the clipboard to _body
Use it if it's useful. No claims made on accuracy, effectiveness or the safety of your data. It's just written so no claim on being bug free:
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 _body to "" -- null out text
repeat with cnt from 1 to (count of theItems)
set selectedItem to value of item cnt 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 " & toolName message "You have selected something that isn't an action"
return
end if
try
set _dueDate to (get due date of selectedItem as date)
on error
set _dueDate to "None"
(* set _dueDate to text returned of (display dialog "Please enter data and time xx/xx/xxxx xx:xx AM/PM." default answer (current date) as string)
set _dueDate to _dueDate as date *)
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 _contect to "None"
end try
try
set _subject to the name of selectedItem
on error
set _subect to "No Subject"
end try
set _body to _body & "Action Item: " & _subject & space & return
set _body to _body & "Due by: " & _dueDate & return
set _body to _body & "Project: " & _project & return
set _body to _body & "Who: " & _context & return & return
end repeat
end tell
set the clipboard to _body