Guest
2010-06-21, 11:15 PM
Quote:
Originally Posted by craig.martell
I've been able to get a list of all the projects in my "default document"
|
You may have seen from this forum that Tim Woods has made some very helpful enhancements to the OF Applescript library in the latest sneaky peek builds. These will enable you to get a list of all projects much more simply (see below).
Quote:
Originally Posted by craig.martell
I want a scpt to fire off that goes to OmniFocus, gets a list like the following:
Project 1
Task 1
Task 2
. . .
Task N
Project 2
Task 1 . . .
etc.
and then sends it back to me in an email.
|
You may find some re-usable elements in this approach:
Code:
tell application "OmniFocus"
-- This approach to getting a flattened project list became possible in
-- in a recent 1.8 Sneak Peek build due to work by Tim Woods
-- ADJUST THE 'WHERE' CLAUSE TO FIT THE NEED
set lstProjects to flattened projects of default document where (status is active)
set strList to ("Projects " & (current date) as string) & return & return
repeat with oProj in lstProjects
set strList to strList & my TaskReport(oProj, "") & return
end repeat
end tell
tell application "Mail"
set oMsg to make new outgoing message with properties {content:strList & return & return}
set visible of oMsg to true
activate
end tell
on TaskReport(oParent, strIndent)
using terms from application "OmniFocus"
tell oParent
set strReport to strIndent & name & return
set strIndent to strIndent & tab
-- ADJUST THE 'WHERE' CLAUSE TO FIT THE NEED
set lstTasks to tasks where completed is false
repeat with oTask in lstTasks
set strReport to strReport & my TaskReport(oTask, strIndent)
end repeat
return strReport
end tell
end using terms from
end TaskReport
Last edited by RobTrew; 2010-06-21 at 11:29 PM..
Reason: Commented the WHERE clauses