The script I’m using was found in this forum. I’ve analysed Hazel logs and It seems the problem maybe related to definition of the variables “Context” and “Project”. It seems don’t know how to get them…
tell application “Finder”
set fileName to (name of theFile)
set {name:fileName, name extension:nameExtension} to theFile
set fileName to text 1 thru ((get offset of “.” & nameExtension in fileName) - 1) of fileName
set theDate to current date
set theTask to “Read «” & fileName & “»”
set theNote to return & return & "Imported by Hazel on " & (theDate as string) & "
"
end tell
tell application “OmniFocus”
tell front document
set theContext to first flattened context where its name = “Any Device”
set theProject to first flattened project where its name = “Read/Review”
tell theProject
set theAction to make task with properties {name:theTask, context:theContext}
set note of theAction to theNote
tell the note of theAction
make new file attachment with properties {file name:theFile, embedded:false}
end tell
end tell
end tell
end tell