View Single Post
Quote:
Originally Posted by aleding View Post
say the project name is "CTI", any idea how I would access certain tasks within that project?
You can either recursively move down through the folders and their project lists until you find a project with a matching name, or you can use the "Complete" method of the Document class, which returns a list of records giving details of any projects or categories with names that fully or partially match some string that you have provided. You can then use the supplied id of a matching project to get a full reference to that project.

For example:

Code:
tell application "OmniFocus"
	set oDoc to front document
	set oProject to my FindProject(oDoc, "CTI")
end tell


on FindProject(oDoc, strProjName)
	using terms from application "OmniFocus"
		tell oDoc
			set recsMatch to complete strProjName as project maximum matches 1
			if length of recsMatch > 0 then
				set oProject to project id (id of item 1 of recsMatch)
			end if
		end tell
	end using terms from
end FindProject