Return the names of all tasks from a perspective & error


#1

I am trying to return the names of all the tasks from my “Today” perspective (with the hope of displaying them on my touchbar with BetterTouchTools). I have gone this far and encountered this error:

tell application "OmniFocus"
	tell front document
		set todayPerspective to perspective "Today"
		set todayTasks to every flattened task of todayPerspective
	end tell
end tell
return todayTasks
error "OmniFocus got an error: Can’t get every flattened task of perspective id \"ehTL9THWgRj\" of default document." number -1728 from every flattened task of perspective id "ehTL9THWgRj" of default document

Any help would be appreciated, thanks!