Hi,
I don’t know Applescript very well - but I’ve used this script in Hazel fine with v1.
set p to POSIX path of “/Users//Dropbox/text_files/of.txt”
set input_file to POSIX path of p
set l to paragraphs of (do shell script "grep . " & input_file)
do shell script “>” & input_file
tell application “OmniFocus” to tell document 1
repeat with v in l
make new inbox task with properties {name:v}
end repeat
end tell
If I run this in the Applescript editor, the make new inbox task line fails with:
error “OmniFocus got an error: Can’t get document 1. Invalid index.” number -1719 from document 1
I still have OF v1 on this machine (I just haven’t gotten around to deleting it yet). Will this cause problems, or is there something else I need to update on that line?
I guess it’s related to having the two versions. Check on Activity Monitor (or your Applications folder) how are your apps identified and change the line below accordingly on your script.
I did something similar recently, based on David’s script. This one sends anything from Hazel to OmniFocus. As inspiration: run this script from Hazel when there was an error, so you have a task to do in OmniFocus.
While we’re on the subject, it’s probably slightly better form to use default document instead of document 1 to ensure your data will go to the main database, rather than an archive or backup that happens to be the current document open.