Otherwise you can retrieve a nested context with code like this:
Code:
on GetContext(strName)
if strName ≠ "" then
tell application "OmniFocus"
tell default document
set lstMatches to flattened contexts where name = strName
if length of lstMatches > 0 then
return first item of lstMatches
else
return (make new context with properties {name:strName})
end if
end tell
end tell
else
return missing value
end if
end GetContext
And you could write a parallel GetProject() by referring to
flattened projects and resorting (where necessary) to
make new project