You could get a list of project objects with code something like this:
Code:
on run
tell application "OmniFocus"
set lstSections to every section of first document
set lstProjects to my ListProjects(lstSections, {})
end tell
display dialog length of lstProjects
end run
on ListProjects(lstSections, lstProjects)
using terms from application "OmniFocus"
repeat with oSectn in lstSections
if class of oSectn is project then
-- append to project list
set end of lstProjects to oSectn
else
-- expand existing project list with any contents of this folder
set lstSubSections to every section of oSectn
if lstSubSections ≠ {} then
set lstProjects to my ListProjects(lstSubSections, lstProjects)
end if
end if
end repeat
end using terms from
return lstProjects
end ListProjects