Guest
2011-06-20, 05:50 AM
Quote:
Originally Posted by marekp
pull the Project name of the ToDo as well
|
I think this should work.
(Note that it truncates the Project name, to make sure that at least part of the Task name is visible).
Code:
property MaxProjChars : 20
tell application "System Events" to if exists process "OmniFocus" then
tell application "OmniFocus"
tell default document
set due_soon to a reference to setting id "DueSoonInterval"
set due_soon_interval to ((value of due_soon) / days) as integer
set due_date to (current date) + due_soon_interval * days
tell (flattened tasks whose completed is false and blocked is false and ((due date is less than or equal to due_date) or (flagged is true or flagged of containing project is true)) and status of containing project is active)
set {lstProj, lstTasks} to {name of containing project, name}
end tell
repeat with i from 1 to length of lstTasks
set item i of lstTasks to "[" & my Truncate(item i of lstProj) & "]: " & item i of lstTasks
end repeat
return lstTasks
end tell
end tell
end if
on Truncate(strLong)
if length of strLong > MaxProjChars then
return text 1 thru MaxProjChars of strLong
else
return strLong
end if
end Truncate
--
Last edited by RobTrew; 2011-06-20 at 06:39 AM..