View Single Post
LeJoh, did you see this thread? http://forums.omnigroup.com/showthread.php?t=20161

I downloaded a demo copy of Hazel and did a bit of fiddling with the script from that thread. I was able to get it to watch a certain file in a folder and make a new OmniFocus action with that file attached and project and context set each time the file changed.

Here's the script I used:
Code:

tell application "OmniFocus"
	tell application "Finder" to set file_name to (name of theFile)
	tell front document
		set NewTask to make new inbox task with properties {name:file_name}
		tell the note of NewTask
			make new file attachment with properties {file name:theFile, embedded:true} -- embed file
		end tell
	end tell
	try
		set task_project to item 1 of (get flattened projects of front document whose name is "Test project")
		set assigned container of NewTask to task_project
		set context of NewTask to item 1 of (get flattened contexts of front document whose name is "Home")
		tell front document to compact
	end try
end tell
Obviously, you'll want to change it to have appropriate values of "Test project" and "Home" :-)

I set up the rule to run if the Date Modified of the watched file is after the Date Last Matched, and invoke the script above.

Better ask me any other Hazel-related questions quickly, before my 14 day demo runs out :-)