View Single Post
That did it!!

Thanks again.

BTW, I like the recursion. I haven't been using nested tasks, but I might start now :-).

I have attached my version of the script, since I use Entourage and not Mail. I also added some code at the beginning that retrieves my Inbox tasks first (using your function).

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 projects of default document where (completed is false)
	
	set strList to ("Projects " & (current date) as string) & return & return & "Inbox" & return
	set in_box to inbox tasks of default document
	repeat with aTask in in_box
		set strList to strList & tab & my TaskReport(aTask, "")
	end repeat
	set strList to strList & return
	repeat with oProj in lstProjects
		set strList to strList & my TaskReport(oProj, "") & return
	end repeat
end tell

tell application "Microsoft Entourage"
	set subjectLine to ("Current Task List " & (current date) as string)
	set strList to strList & return & return
	set currentTaskList to make new outgoing message with properties {subject:subjectLine, content:strList, recipient:"email@domain.com"}
	send currentTaskList
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 craig.martell; 2010-06-22 at 07:19 AM..