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 > OmniPlan > OmniPlan Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Applescript creation of tasks with existing dates Thread Tools Search this Thread Display Modes
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)
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.
 
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

(http://appscript.sourceforge.net/py-...ual/index.html)

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"])
Now to have my script rip back through and update my basecamp Due Dates :)
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Script: listing tasks by their creation date RobTrew OmniFocus Extras 0 2011-07-26 02:29 AM
can't move pre-existing project in to pre-existing folder kbs1138 OmniFocus 1 for Mac 3 2011-06-16 11:22 AM
OmniFocus AppleScript for Statistics Creation (for download) digitalimago OmniFocus Extras 30 2011-01-12 03:06 PM
Importing existing tasks from a PC Cantankerous OmniFocus for iPad 2 2010-08-02 06:45 AM
AppleScript automating creation of Finder & Mail folders omnibob OmniFocus Extras 4 2009-07-20 01:25 AM


All times are GMT -8. The time now is 05:33 AM.


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