AppleScript to select task by name

I am wondering how I can select an existing task by name with AppleScript. My goal is to have Hazel run an AppleScript to mark an OmniFocus task as complete (identified by the name of the task) when Hazel sees a certain file in a specified folder. I know how to make this work in Hazel, but I can’t figure out the AppleScript to select an OF task by name.

I am returning to OF from a short stint using Things. The Things AppleScript to do this was very simple, and I figured that it should also be easy to create in OF, but I am having a hard time figuring out how to do this!

This might get you started …

property pTaskName : "confirm meeting to set contract"

on run
  tell application "OmniFocus"
	  tell content of front document window of default document to ¬
	    set theTask to (id of every leaf whose name is pTaskName)
   end tell
end run


JJW