View Single Post
You'll need to get references to Project and Context objects.

Something roughly like this:

Code:
tell application "Finder" to set file_name to (name of theFile)

set theDate to current date
set theNote to "Scanned " & (theDate as string) & " 

"
set projectname to "Proceed Files"

set ContextName to "Some Context"

set theTask to "Proceed: \"" & file_name & "\""

tell application "OmniFocus"
	set task_title to theTask
	tell default document
		set oProj to my GetProject(it, projectname)
		set oContext to my GetContext(it, ContextName)
		
		tell oProj
			tell (make new task with properties {name:task_title, context:oContext})
				set its note to theNote
				tell its note to make new file attachment with properties {file name:file_name, embedded:false}
			end tell
		end tell
	end tell
end tell


on GetProject(oDoc, strName)
	using terms from application "OmniFocus"
		tell oDoc
			set lstProj to flattened projects where name = strName
			if lstProj ≠ {} then
				item 1 of lstProj
			else
				make new project with properties {name:strName}
			end if
		end tell
	end using terms from
end GetProject

on GetContext(oDoc, strName)
	using terms from application "OmniFocus"
		tell oDoc
			set lstContexts to flattened contexts where name = strName
			if lstContexts ≠ {} then
				item 1 of lstContexts
			else
				make new context with properties {name:strName}
			end if
		end tell
	end using terms from
end GetContext