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.

Thanks!
Ethan
 
Take a look at David Sparks website www.macsparky.com

This is the post which will get you moving in the correct direction. http://macsparky.com/blog/2012/8/app...mnifocus-tasks
 
Also, there is this forum post with a similar question.

http://forums.omnigroup.com/showthread.php?t=29790
 
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.

Quote:
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!
Ethan
 
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.

Code:
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)?
 
Quote:
Originally Posted by ekaplan1020 View Post
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)?
Try this.

Code:
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_folder to first flattened folder where name = "Matters"
		set the_context to first flattened context where its name = "Mac"
		set the_project to make new project with properties {name:project_name} at end of projects of the_folder
		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
 
You are awesome! Thanks so much.
 
You are welcome.

In your research towards implementing some of the more advanced aspects of OmniFocus I would suggest looking at a few things.
  1. David Sparks website as he is both a Mac user and a lawyer. He has a great website http://macsparky.com and his book "Paperless" is well done http://macsparky.com/paperless/.
  2. A book "Creating Flow with OmniFocus" by Kourosh Dini here http://www.usingomnifocus.com. He also has a new book "Workflow: Beyond Productivity" I have not had a chance to read yet; which is here http://www.masteryinworkflow.com.
  3. A solution and resource by Chris Sauve to create OmniFocus projects from templates is very useful http://cmsauve.com/projects/templates/.
 
That Templates applescript is great. Well worth learning how it works
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes



All times are GMT -8. The time now is 02:09 PM.


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