Essentially you will want to loop through Folders (if you use them) and their Projects. In my case I manually set
to the Folder I am interested in reporting (this is constant, it is a top level folder that represents my
work as that's what I use the script for .. I don't report on my personal projects). The variable
is set earlier in the script based on "now".
Code:
tell front document of application "OmniFocus"
set subFolders to every folder of theFolder
set folderProjects to every project of theFolder whose (singleton action holder is false) and (status is not dropped) and (status is not on hold) and ((status is not done) or (status is done and completion date > my previousOneWeeks))
set folderHoldProjects to every project of theFolder whose (status is on hold)
try
set individualTasks to every task of theFolder
on error
set individualTasks to {}
end try
end tell
-- at this point subFolders is a list of subFolders that need processing
-- folderProjects is top-level projects in my desired reporting folder that need to be reported on
-- folderHoldProjects is projects in-scope but on hold (I report those with different formatting)
-- individualTasks is either empty or a list of "loose" tasks
-- write some static HTML like beginning a HTML table
repeat with i from 1 to (count of folderProjects)
processProject(item i of folderProjects)
end repeat
Note: the code above won't run and won't even compile ... it's just some snips from my script that are how I got started.