OmniFocus 3 - Script to remove "Today" tag and mark complete


I’d love to have a script for OmniFocus 3 that removes the “Today” tag and marks a task complete (or vice versa). Is this possible?

I have many repeating tasks (often deferred upon completion) that I might tag as “Today”, but don’t want to be tagged as such in their next instance.

I have little knowledge of OF scripting - in particular for OF3 - though I have cobbled some things together for OF2. Any guidance is appreciated!

Request: automate adding and removing tags to multiple tasks [Solved!]

this seems to work

tell application "OmniFocus"
	delay 0.2
	tell front window
		set selectedTrees to selected trees of content
		set selectedTasks to every item of selectedTrees
	end tell
	tell front document
		repeat with i from 1 to count of selectedTasks
			set theTask to the value of item i of selectedTasks
			set currTags to name of tags of theTask
			repeat with x from 1 to count of currTags
				set currTag to item x of currTags
				if currTag = "today" then
					set currTag to (first flattened tag whose name is item x of currTags)
					remove currTag from tags of theTask
				end if
			end repeat
			mark complete theTask
		end repeat
	end tell
end tell


It does! You rock. Thanks so much!