The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
All tasks in a project? Thread Tools Search this Thread Display Modes
ALL:

Thanks in advance for your help. I've been able to get a list of all the projects in my "default document" in OmniFocus (thanks to all the help here :-). However, I need to be able to print out every task in each project. Any ideas?

Here's my goal. When I send email to myself with a particular subject line, 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. Any help would be appreciated.

Thanks,

Craig
 
Quote:
Originally Posted by craig.martell View Post
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 View Post
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
 
Thanks Rob. I did see that the latest sneaky peak will help. I might give that a try. Thanks for the script as well. I will see what I can do with it.

Craig
 
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..
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Duplicate Tasks in Project bmushrush OmniFocus 1 for Mac 2 2012-09-29 03:02 PM
No tasks available in project lcottrell OmniFocus 1 for Mac 7 2010-11-16 07:36 AM
How to delay all tasks in a project? GreenLorax OmniFocus 1 for Mac 2 2008-06-09 08:55 AM
Tasks with no project tobyw OmniFocus 1 for Mac 5 2008-01-25 09:05 PM
Single tasks as project groups & context vs project group eatmytag OmniFocus 1 for Mac 48 2007-08-17 11:07 AM


All times are GMT -8. The time now is 08:47 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.