Creating a new subtask in an existing task of an existing project (OmniFocus)

I know how to use AppleScript to create a new inbox, but I want to create a subtask of an existing task in an existing project. Is this possible?

Thanks in advance!

What Mac app are you referencing here? I don’t see one mentioned in the title or the body of the post.

Sorry, I’m recovering from a cold and yeah, didn’t proofread.

I’m talking about OmniFocus. Specifically, I’m trying to create a new PopClip extension based on the Omnifocus popclip extension. I’ve modified the applescript in that extension to:

tell application "OmniFocus"
	activate
	tell quick entry
		open
		set _task to make new inbox task with properties {name:"test"}
	end tell
	tell application "System Events"
		keystroke (ASCII character 31)
		keystroke "'" using command down
	end tell
	move _task to end of tasks of task "Amazon" of flattened project "In Shipping"
end tell

I get this error though:
error “OmniFocus got an error: Can’t get flattened project “In Shipping”.” number -1728 from flattened project “In Shipping”

I’m also not sure at what point I can attempt to move the new task… when it’s been moved from QuickEntry into the inbox? Directly from within quickentry?

Do you still need the project ID for nesting rather than the project name?

http://forums.omnigroup.com/showthread.php?t=22957

If I try to do this:

move _task to end of tasks of task "Amazon" of flattened project id "k0TbBaatgrO"

I get this:
error “OmniFocus got an error: Can’t get project id “k0TbBaatgrO”.” number -1728 from project id “k0TbBaatgrO”

I managed to muddle through this. In case anyone is ever searching for it, here it is:

tell application "OmniFocus"
	activate
	tell quick entry
		open
		set _task to make new inbox task with properties {name:"test"}
	end tell
	
	tell application "System Events"
		keystroke (ASCII character 13)
	end tell
	
	tell default document
		set _newTask to last inbox task
		set _targetProject to first flattened project whose name is "In Shipping"
		move _newTask to end of tasks of task "Amazon" of _targetProject
	end tell
end tell
1 Like