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

 
Applescript Snippet Request: Get Tasks for Context Thread Tools Search this Thread Display Modes
Hi,

I am writing an Applescript where I want to iterate thru all of the tasks within a given context.

For example:

- get all tasks with a context of "Waiting"...
--- then for each task....
---- do something

If anyone has a code snippet that could get me started I would appreciate it.

Thanks in advance!

Ken
 
Hope this makes sense:

Code:
tell application "OmniFocus"
	set strContextName to "Waiting"
	tell front document
		set lstMatches to complete strContextName as context
		if length of lstMatches > 0 then
			set recMatch to item 1 of lstMatches
			set strID to id of recMatch
			set oContext to context id strID
			
			set lstAllTasks to tasks of oContext
			set lstAvailable to available tasks of oContext
			set lstRemaining to remaining tasks of oContext
		else
			display dialog "Context: " & strContextName & " not found."
		end if
	end tell
end tell
 
Rob,

Thank you! That worked perfectly!

Regards,

Ken
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tasks without context but in projects with context jochen OmniFocus 1 for Mac 2 2011-02-05 03:10 AM
Need basic applescript for changing context tah OmniFocus Extras 8 2009-07-30 12:51 PM
AppleScript to add tasks in a particular context to iCal for notifications dmcg OmniFocus Extras 0 2009-01-08 03:20 PM
Applescript example: listing by context RobTrew OmniFocus Extras 0 2007-08-21 01:31 AM
SP12: FogBUGZ snippet expansion corrupts multiline text fields dnanian OmniWeb Bug Reports 3 2006-06-07 04:41 AM


All times are GMT -8. The time now is 12:10 PM.


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