View Single Post
Thanks for the help Lizard.

I tried your code and it causes an error when the task is not found instead of returning false.

I think this is the ticket:
Code:
-- Finds a Task
--   _id : tracid of task
on findTask(_id)
	tell application "OmniPlan"
		tell first document
			try
				set t to first task whose value of custom data entry "tracid" is _id
			on error errmesg number errn
				if errn is -1719 then
					return false
				else
					error errmesg number errn
				end if
			end try
			return t
		end tell
	end tell
end findTask