The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Applescript Snippet Request: Get Tasks for Context (http://forums.omnigroup.com/showthread.php?t=11267)

kenclark 2009-02-07 12:47 PM

Applescript Snippet Request: Get Tasks for Context
 
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

RobTrew 2009-02-10 02:52 AM

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[/CODE]

kenclark 2009-02-12 02:46 AM

Rob,

Thank you! That worked perfectly!

Regards,

Ken


All times are GMT -8. The time now is 06:04 PM.

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