Bulk assign task details

Hello All,

I have tasks coming into Omnifocus via various methods, and would like to run a script to capture the tasks and update some details to force me to organise them… I always forget about items in the inbox, so would rather have them appear in one of the other perspectives.

I have the following code, which I expected to give each task a date… However, this is also assigning today’s date to reocurring tasks from the future! I’ve tried, but can’t quite get my head around how to filter out other tasks.

on run
tell application "OmniFocus"
	set todayDate to current date
	
	tell default document
		set todayTasks to (flattened tasks) where due date is missing value) and completed is false)
		
		repeat with t in todayTasks
			"Task name " & t's name
			 set t's due date to todayDate
		end repeat
	end tell
end tell

end run

Ideally what I would like from a script, is to assign a date of today, and a project/context of ‘To Organise’ to all tasks currently with no date or project set…

Hope that makes sense!

Thanks in advance.