View Single Post
I am trying to figure out how to move a project from the bottom of the projects list to a specified folder. I am starting by figuring out how to duplicate a selected project to another location. I have:

Code:
tell application "OmniFocus"
	tell front document
		tell document window 1
			set theSelectedItems to selected trees of sidebar
			set theA to {tree 2 of tree 2 of sidebar of document window id 128 of document id "fqCMFexKSD8" of application "OmniFocus"}
			set theX to (value of item 1 of theSelectedItems)
			set theY to folder of theX
			set theZ to section of theY
			duplicate (value of item 1 of theSelectedItems) to after theA
		end tell
	end tell
end tell
I get:
  • "OmniFocus got an error: Can’t make {tree 2 of tree 2 of sidebar of document window id 128 of document id "fqCMFexKSD8"} into type specifier," when when I try to duplicate the project to after theA.
  • "OmniFocus got an error: Attempted to move data objects to a nil container," when I try to duplicate the project to after theX and theY.
  • "OmniFocus got an error: Can’t make {project id "oxQPHIP8MtA" of document id "fqCMFexKSD8", etc.} into type specifier," when I try to duplicate the project to after theZ.

How do I write a command that will move the selected project to a specified location?

Thanks,
Rebecca