Hazel and Omnifocus help

Hi! Long time listener of MPU and other relay shows. I’ve recently been having issues with some applescript I was using to have Hazel create a new project in Omnifocus when PDF files are created in a folder. I was hoping to get some help with this. I think I originally found this applescript in the Omnifocus or Hazel field guide (Thanks David!). It recently stopped working.

Any help would be greatly appreciated!

– Ask Omnifocus to create tasks

tell application “OmniFocus”
set theProject to item 1 of inputAttributes
tell default document
set theProject to make new project with properties {name:item 1 of inputAttributes}
tell the note of newTask
make new file attachment with properties {file name:item 1 of inputAttributes, embedded:true}
end tell
end tell
end tell

1 Like

Welcome! It at least needs a line between set theProject... and tell the note that makes newTask, e.g.

set newTask to make new task at end of tasks of theProject with properties {name:item 1 of inputAttributes}

Without that line, you’ll be getting an undefined variable error.

Also, do you still have something added in inputAttributes?