One approach to a GetProject function might look like this:
Code:
tell application id "OFOC"
set oDoc to default document
set oProj to my GetProject(oDoc, "Integrate top-level themes")
end tell
on GetProject(oDoc, strName)
using terms from application "OmniFocus"
tell oDoc
set lstProj to flattened projects where name begins with strName
if length of lstProj < 1 then return missing value
return item 1 of lstProj
end tell
end using terms from
end GetProject