Guest
2011-01-12, 09:26 PM
I notice that the ListNext script (for writing a list of next actions to a file) has been downloaded quite a lot over the years.
As of OmniFocus ver. 1.8, it can be written much more simply, without recursion. Adopting WhPalmer4's improvement to allow for special characters when writing the file, the whole script could now be abbreviated to something like:
Code:
on run
-- GET THE DUE DATES, NAMES, AND CONTAINING PROJECTS OF ALL NEXT ACTIONS
tell application id "com.omnigroup.omnifocus"
tell default document
set refTasks to a reference to (flattened tasks where next is true)
set {lstDue, lstTask, lstProject} to {due date, name, name of its containing project} of refTasks
end tell
end tell
-- BUILD A LINE OF TEXT FOR EACH ACTION
set str to "Next" & return
repeat with i from 1 to length of lstTask
set {dteDue, strName, strProject} to {item i of lstDue, item i of lstTask, item i of lstProject}
set strDue to ""
if dteDue is not missing value then set strDue to short date string of dteDue
set str to str & tab & strDue & tab & strName
if strProject ≠ strName then set str to str & " [" & strProject & "]"
set str to str & return
end repeat
set fRef to (open for access ((POSIX path of (path to desktop) as string) & "NextActions.txt") with write permission)
write str to fRef
close access fRef
end run
Last edited by RobTrew; 2011-01-13 at 02:24 AM..