View Single Post
Quote:
Originally Posted by Christian View Post
Is this the complete code necessary? Can I run the script with just this and it will work? Thankee.
Hi Christian,
This is what I am using. (Note that it is part of a bigger script, and so some variables are not properly declared in the example below)
-Ricky


Code:
(*  Since this code is copied from part of a larger script, 
it is missing the variable declerations. 
Make sure to  Set Variables as needed:
 
set FolderName to ... 
set ProjectName to ... 
etc… 
*)


tell application "OmniFocus"
	--activate
	set theDoc to default document
	
	tell theDoc
		
		set StatusContext to context "ContextInHere" of context "ParentContext" --modify as needed
		
		--Create the folder with Project and Task
		set NewAcctFolder to (make new folder with properties {name:FolderName} at end of folder id RootFolderID)
		set NewOppProject to (make new project with properties {name:ProjectName, note:ProjectNote, context:StatusContext} at end of projects of NewAcctFolder)
		set NewStatusTask to (make new task with properties {name:TaskName, note:TaskNote, context:StatusContext} at end of tasks of NewOppProject)
	
	end tell
end tell