Thanks @ Mr_Noodle!
The error i get in log is:
If I use “create new task” I get this error:
NSLocalizedDescription = “OmniFocus got an error: AppleEvent handler failed.”;
If I use create new inbox task I get the error:
“OmniFocus got an error: Can\U2019t make or move that element into that container.”
The script is:
```
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 “Review «” & fileName & “»”
set theNote to return & return & "Imported by Hazel on " & (theDate as string) & "
"
end tell
tell application “OmniFocus”
tell front document
set theTag to first flattened tag where its name = “Review”
set theProject to first flattened project where its name = “ToDo”
tell theProject
set theTask to make task with properties {name:theTask, tag:theTag}
set note of theTask to theNote
tell the note of theTask
make new file attachment with properties {file name:theFile, embedded:false}
end tell
end tell
end tell
end tell
```