View Single Post
Originally Posted by dbyler View Post
getContext returns the best match for a given string, so "home" would match "Home" before the "Home > Garden" context.
And if there is no match, you can always extend getContext to create one:

on getContext(contextName)
	tell application "OmniFocus"
		tell front document
				first flattened context whose name contains contextName
			on error
				(make new context with properties {name:contextName})
			end try
		end tell
	end tell
end getContext