Applescript to create or update an OmniPlan task

I am trying to sync some tasks with an external system. To start with, I’ll sync one-way: calling an applescript with the task information, and having it either create the task if it doesn’t exist, or update it if it does.

I can’t be the first to do this, but lots of searching has only found things for OmniFocus, or that require very old versions of OS X.

Any ideas?

Paul L.

Here’s a slice out of a bug-importing script. I make no warranties as to the usefulness, or compile-ability of the script. Note the use of a custom data column for pairing OmniPlan tasks with items in the external system.

                set t to lookup in "bugID" given custom data entry:(thisID as string)
		if exists t then
			set duration of t to thisEstimate
			set completed of t to thisWork
		else
			set t to make new task with properties {name:thisTitle, duration:thisEstimate, completed:thisWork} at end of tasks of g
			set custom data of t to {|bugID|:thisID}
		end if
		
		delete assignments of t
		
		try
			if thisOwner is missing value or thisOwner is {} or (class of thisOwner) is application then
				thisOwner = "Unassigned"
			end if
			set thisOwner to thisOwner as string
		on error
			thisOwner = "Unassigned"
		end try
		
		if not (exists resource thisOwner) then
			make new resource with properties {name:thisOwner}
		end if
		
		assign resource thisOwner to t