View Single Post
Latest iteration of the script is below. I attempted to set the project of the selected tasks analogously to the way I set the context, but I get this error message:

Quote:
OmniFocus got an error: Can’t get project "Operations & Finance" of project "Work" of document 1.
Code:
tell application "OmniFocus"
	tell front document
		set theContext to the context "Online" of context "Mac"
		set theProject to the project "AP, AR, Finance" of project "Operations & Finance" of project "Work"
		tell content of document window 1 -- (first document window whose index is 1)
			set theSelectedItems to value of every selected tree
			if ((count of theSelectedItems) < 1) then
				display alert "You must first select an item to complete." as warning
				return
			end if
			repeat with anItem in theSelectedItems
				set context of anItem to theContext
				set due date of anItem to current date
				set project of anItem to theProject
			end repeat
		end tell
	end tell
end tell