Lizard's code will certainly work with top-level contexts and top-level projects, but it's possible that you may have some nested contexts, and sooner or later some of your projects may be contained by folders. The code above will fail with these.
One alternative would be to use the
parse tasks function, using strings of the pattern described in the OF Help file under:
Processing Mail messages into actions
The simplest pattern might use something like this:
Code:
on ParseTask(strText)
tell application id "OFOC"
tell default document
return (parse tasks with transport text strText with as single task)
end tell
end tell
end ParseTask