The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   Applying OmniFocus (http://forums.omnigroup.com/forumdisplay.php?f=51)
-   -   OF, Dropbox, and Hazel - How to add projects automatically (http://forums.omnigroup.com/showthread.php?t=30161)

ekaplan1020 2013-06-27 07:27 PM

OF, Dropbox, and Hazel - How to add projects automatically
 
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

Dale 2013-06-27 08:28 PM

Take a look at David Sparks website [url]www.macsparky.com[/url]

This is the post which will get you moving in the correct direction. [url]http://macsparky.com/blog/2012/8/applescript-omnifocus-tasks[/url]

Dale 2013-06-27 08:56 PM

Also, there is this forum post with a similar question.

[url]http://forums.omnigroup.com/showthread.php?t=29790[/url]

ekaplan1020 2013-06-28 07:05 AM

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[/QUOTE]

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

Dale 2013-06-28 11:59 AM

I do not consider myself proficient at scripting. This script is basic and works when I test it.
[LIST][*]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[/LIST]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[/CODE]

ekaplan1020 2013-06-28 12:22 PM

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)?

Dale 2013-06-28 01:23 PM

[QUOTE=ekaplan1020;125799]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]

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[/CODE]

ekaplan1020 2013-06-28 01:26 PM

You are awesome! Thanks so much.

Dale 2013-06-28 01:44 PM

You are welcome.

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

kingsinger 2013-08-25 07:06 PM

That Templates applescript is great. Well worth learning how it works


All times are GMT -8. The time now is 11:17 AM.

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