The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniPlan Extras (http://forums.omnigroup.com/forumdisplay.php?f=45)
-   -   Applescript creation of tasks with existing dates (http://forums.omnigroup.com/showthread.php?t=17716)

nikolaj 2010-09-01 04:16 PM

Applescript creation of tasks with existing dates
 
I am finishing up my python script (using appscript) to import all our project/clients/todos/time entries from basecamp and am having trouble figuring out how to set the start/end date of a task and have it stick.

Right now i am setting the project start date to the earliest existing Todo from my basecamp export, then i am setting the start/end date of each task as I create them.

Here is what I am doing (summarized and in appscript parlance):

[CODE]doc=app("OmniPlan").make(new=k.document)
doc.project.starting_date=earliest_date
for todo in todos:
d={k.name:todo.name,
k.start_date:todo.start_date,
k.end_date:todo.end_date}
doc.make(new=k.task,with_properties=d)[/CODE]

When I run this all my tasks are lined up at the project start with start and end like:

start:
Actual: T day 8:00 AM
Baseline: T+494w 1d 12:00 AM

I am still hunting for any examples on creating existing tasks with actual start/stop dates, but any help would be greatly appreciated.

Hopefully if I can get this ironed out i will post my scripts so others can utilize them.

nikolaj 2010-09-02 05:44 PM

update
 
Ok, so i got this working. I had to create the project, build tasks and organize them into subtasks, then set the project start date, and finally run through all tasks again and set their starting/ending time.

Roughly, this is how i do it with python/py-appscript

([url]http://appscript.sourceforge.net/py-appscript/doc/appscript-manual/index.html[/url])

[CODE]
# assume todos=[{"name":"task name","basecamp_id":"123","start_date":datetime,"end_date":datetime}]
from appscript import *
doc=app("OmniPlan").make(new=k.document)
all_tasks=[]
# create your resources
r=doc.make(new=k.resource,with_properties={k.name:t["assigned"]})
for t in todos:
# here you might add a resource r
task=doc.make(new=k.task,with_properties={k.name:t["name"]})
task.assign(to=r)
task.custom_data.set({"basecamp_id":t["basecamp_id"]})
# i move to a parent task here:
# doc.move(task,to=project_task.child_tasks.end)
all_tasks.append((task,t)) # keep a record of this task and the todo for later

# then set the project start date
doc.project.starting_date.set(earliest_date)

# then iterate through all tasks AGAIN and set the start/end
for t in all_tasks:
t[0].starting_date.set(t[1]["starting_date"])
t[0].ending_date.set(t[1]["ending_date"])
[/CODE]

Now to have my script rip back through and update my basecamp Due Dates :)


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

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