View Single Post
Quote:
Originally Posted by gshenaut View Post
Is there some way to not include projects with names like "Foobar" for input "Foo" using "complete"?
You just need to iterate through the list of matches, and pull out the exact ones.

e.g. something like:

Code:
tell application "OmniFocus"
	set oDoc to front document
	set strName to "xyz" as string
	set lstProjects to my ExactMatchProjects(oDoc, strName)
end tell

on ExactMatchProjects(oDoc, strName)
	using terms from application "OmniFocus"
		tell oDoc
			set lstExact to {}
			set lstMatches to complete strName as project
			if (count of lstMatches) > 0 then
				repeat with recMatch in lstMatches
					set {_, _, strID, strMatch} to recMatch as list
					if strMatch is strName then
						set end of lstExact to project id strID
					else
						-- sorted by score, so there will be no more
						-- exact matches
						exit repeat
					end if
				end repeat
			end if
		end tell
	end using terms from
	lstExact
end ExactMatchProjects

Last edited by RobTrew; 2010-05-07 at 11:55 PM..