The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Possible to add task to a project without calling compact? (http://forums.omnigroup.com/showthread.php?t=30981)

devon 2013-10-29 06:26 AM

Possible to add task to a project without calling compact?
 
I have written a simple script (Ruby which uses AppleScript calls to interact with OmniFocus) that syncs my Jira tickets with my OmniFocus task list. However I haven't figured out how to add a task to a project without creating it as an inbox task, marking it's assigned container to the project I want to put it in, and then calling compact.

This works, however by calling compact every 10 minutes (my script schedule), it clears all the completed tasks from my perspective, whereas I personally like to see what I've checked off that day, and only run Clean Up at the end of the day, so I can see my progress, not just what's left ahead.

Any ideas on how I can add a new task to the project without having to call compact?

Thanks!

Devon

Lizard 2013-10-29 08:42 AM

You probably want to tell the project to create the task, rather than the app/inbox.

devon 2013-10-29 08:46 AM

Thanks Lizard! Do you know where I can find an example or docs that would cover that type of flow? Looking at the OmniFocus AppleScript dictionary I don't see any methods on the project class to adding tasks? I'm very new to this stuff, so I could just be missing it:) Thanks in advance!

Devon

Lizard 2013-10-29 10:02 AM

Other scripts posted in this Extras forum are probably the best documentation/examples available.

devon 2013-10-29 10:25 AM

Got it figured out! If anyone else is trying to solve this via Ruby appscript you need to do something like this:

....
proj_name = new_task_properties["project"]
proj = omnifocus_document.flattened_tasks[proj_name]
.... build task props
proj.make(:new => :task, :with_properties => tprops)



Instead of the old:

new_task = omnifocus_document.make(:new => :inbox_task, :with_properties => tprops)
new_task.assigned_container.set(proj)
omnifocus_document.compact

I had before.

devon 2013-11-08 06:54 AM

If anyone is interested you can see my completed, very simple, Jira to OmniFocus integration script here: [url]http://www.digitalsanctuary.com/tech-blog/general/jira-to-omnifocus-integration.html[/url]


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

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