View Single Post
Although creating and then closing a temporary window is even simpler ...

set lstProjects to ProjectList("all-projects")

on ProjectList(strFilter)
	tell application id "com.omnigroup.OmniFocus"
		tell front document
			tell (make new document window)
				set selected view mode identifier to "project"
				set focus to {}
				tell sidebar
					select library
					set selected smart group identifier to strFilter
				end tell
				set lstProject to {}
				repeat with oTree in trees of content
					set end of lstProject to value of oTree
				end repeat
			end tell
		end tell
	end tell
end ProjectList