Hi all,
I’m trying to automate adding a PDF dropped into a dropbox folder with Hazel as a task in Omnifocus, with the project “Home” and the context “Anywhere”. Both are pre-existing. The basic applescript works, but I can’t figure out how to add the project and context. Any help would be appreciated. Here is the script:
tell application "Finder" to set file_name to (name of theFile)
set theDate to current date
set theNote to "Scanned " & (theDate as string) & "
"
set projectname to "Read"
set theTag to "Anywhere"
set theTask to "Review \"" & file_name & "\""
tell application "OmniFocus"
set task_title to theTask
tell front document
set newTask to make new inbox task with properties {name:task_title, primary tag:theTag}
set theProject to projectname
set note of newTask to theNote
move newTask to end of tasks of theProject
tell the note of newTask
make new file attachment with properties {file name:theFile, embedded:true}
end tell
end tell
end tell