The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > Applying OmniFocus
FAQ Members List Calendar Search Today's Posts Mark Forums Read

OF, Dropbox, and Hazel - How to add projects automatically Thread Tools Search this Thread Display Modes
I am an attorney that uses a case management program that doesn't have very good task management. I am wanting to incorporate OmniFocus as I have heard many good things. When I add a case/matter to my case management program it syncs with Dropbox and automatically creates a folder directory (e.g. Doe, John\Doe-CriminalLaw-0001\). Using Hazel, automator and Applescript, I then make subfolders automatically when the new folder is added (e.g. 1 Correspondence, 2 Court Docs, 3 Billing...).

Is there a way to use applescript and hazel to automatically create an OmniFocus project for each new matter when a new folder is added to Dropbox? I have tried figuring it out, but it is above my head at this point. It would be great if I could then figure out how to automatically assign a set of tasks for each new project depending on the type (e.g. Conflicts Check, Draft Petition, Serve Defendant, etc.).

Any help would be appreciated as I have seen some really great ideas and solution while searching the forum.

Take a look at David Sparks website

This is the post which will get you moving in the correct direction.
Also, there is this forum post with a similar question.
Thanks for the quick response Dale. I did check those out and I am still struggling with the way to get the folder names created and use them to set project name, context, etc.

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 "Test Project"

set theTask to "Review \"" & file_name & "\""

tell application "OmniFocus"
set task_title to theTask
tell default document
set newTask to make new inbox task with properties {name:task_title}
set theProject to projectname
set note of newTask to theNote
tell the note of newTask
make new file attachment with properties {file name:theFile, embedded:false}
end tell
end tell
end tell
This creates a task and sets the projectname to "Test Project". How would I set the project name to the name of the folder?

Thanks again for your help!
I do not consider myself proficient at scripting. This script is basic and works when I test it.
  • Creates project with name equal to file's parent folder name
  • Creates task inside project with context set as "Mac"
  • Creates note for task with comment and link to file
I hope this helps getting you closer to what you want to do with your initial question.

tell application "Finder"
	set project_name to name of container of (theFile)
	set file_name to name of (theFile)
	set the_date to current date
	set the_note to "Added on " & (the_date as string) & " 

end tell

tell application "OmniFocus"
	tell default document
		set the_project to make new project with properties {name:project_name}
		set the_context to first flattened context where its name = "Mac"
		tell the_project
			set the_action to make new task with properties {name:"Review \"" & file_name & "\"", context:the_context}
			set note of the_action to the_note
			tell the note of the_action
				make new file attachment with properties {file name:theFile, embedded:false}
			end tell
		end tell
	end tell
end tell
Wow! That worked like a charm. Thanks Dale! Is there an adjustment to the applescript that would put it in a folder called "Matters" (already created)?

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

All times are GMT -8. The time now is 06:45 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.