Omnifocus tag script

Can anyone please help.

Rose created an Applescript for me that would add a task in Omnifocus to pay someone in 30 days. This is triggered by the invoice being dropped into a certain folder using Hazel. It works great! However I am now using the beta of OF3 on the mac.

How can I modify the following script so that rather than applying a context, it applies up to 3 tags?


Script -

set theDate to (current date) + (30 * days)

set fileName to item 1 of inputAttributes

tell application "OmniFocus 2"

	tell front document
		set theContext to first flattened tag where its name = "My Studio"
		set theProject to first flattened project where its name = "SL Invoices to pay"
		tell theProject to make new task with properties {name:("Pay " & fileName), defer date:{theDate}, deprecated context:theContext}
	end tell

end tell

I’m fairly certain all you need to do is change deprecated context to primary tag and the rest should still work - unfortunately it seems like Hazel is running into some issues in my testing, but the script does compile in Script Debugger which is always a good start!

Hi. That’s great, but what if I want to add 3 tags? Thanks