By hacking together a Rob Trew script together with
this Veritrope one I've cobbled something together which works nicely for my purposes. It's uncommented but probably self explanatory all the same. If it proves useful for someone, then that'd be super!
Code:
tell application "OmniFocus"
set list_Projects to {}
set list_Folders to {}
set exclude_areas to {"Personal", "Management", "Someday/ Maybe"}
set oDoc to default document
set ExportList to "Current List of Active Projects" & return & "---" & return & (current date) & return & return as Unicode text
set folderObjs to (folders of oDoc)
-- SORT THE LIST
set show_section to false
repeat with folder_obj in folderObjs
if name of folder_obj is not in exclude_areas then
set thisSection to return & "##" & name of folder_obj & return & return
set projectObjs to (projects of folder_obj where hidden of its folder is false and its status is active)
repeat with project_obj in projectObjs
if project_obj is not singleton action holder then
set thisSection to thisSection & name of project_obj & " " & return
set show_section to true
end if
end repeat
set subFolderObjs to (folders of folder_obj)
repeat with subfolder_obj in subFolderObjs
set thisSection to thisSection & return & "###" & name of subfolder_obj & return & return
set projectObjs to (projects of subfolder_obj where hidden of its folder is false and its status is active and (its start date is missing value or start date < (current date)))
repeat with project_obj in projectObjs
if project_obj is not singleton action holder then
set thisSection to thisSection & name of project_obj & " " & return
set show_section to true
end if
end repeat
end repeat
if show_section then
set ExportList to ExportList & thisSection
set show_section to false
end if
end if
end repeat
set ExportList to ExportList & return & return & "Completed Tasks" & return & "---" & return & return
set week_ago to (current date) - 7 * days
tell oDoc
set refDoneInLastWeek to a reference to (flattened tasks where (completion date ≥ week_ago))
set {lstName, lstContext, lstProject, lstFolder, lstDate} to {name, name of its context, name of its containing project, name of folder of its containing project, completion date} of refDoneInLastWeek
set strText to ""
repeat with iTask from 1 to count of lstName
if lstFolder is not in exclude_areas then
set {strName, varContext, varProject, varDate} to {item iTask of lstName, item iTask of lstContext, item iTask of lstProject, item iTask of lstDate}
if varDate is not missing value then set strText to strText & short date string of varDate & " - "
if varProject is not missing value then set strText to strText & " [" & varProject & "] - "
set strText to strText & strName
if varContext is not missing value then set strText to strText & " @" & varContext
set strText to strText & " " & return
end if
end repeat
end tell
set ExportList to ExportList & strText as Unicode text
set fn to choose file name with prompt "Name this file" default name "Weekly Development Report" & ¬
".md" default location (path to desktop folder)
tell application "System Events"
set fid to open for access fn with write permission
write ExportList to fid
close access fid
end tell
end tell