OmniFocus 3 AppleScript Guide
Below, "task" means the literal string "task". "tasktype" means a reference to an object of class "task".
make new (task|tag|project|folder) with properties {property:value[, property:value...]}
move (tasktype|tagtype|projecttype|foldertype) to (end of (tags|projects|folders) of (tagtype|projecttype|foldertype))
remove tagtype from tags of tasktype
add tagtype to tags of tasktype
set (tasktype|projecttype) to the parent task of tasktype
(task|tag|project|folder) whose name is string
(task|tag|project|folder) where its name is string
flattened (tasks|tags|projects|folders)
: retrieve matching items without
having to locate them within a specific hierarchytell front document of application "OmniFocus"
-- Create a new project and save to variable `theProject`
set theProject to make new project with properties {name:"Project Name", singleton action holder: true}
-- Create a new task and save to variable `theTask`
set theTask to make new inbox task with properties {name:"Task Name", note:"Task Note"}
-- Move `theTask` inside of `theProject`
move theTask to end of tasks of theProject
-- Create a new task directly inside `theProject`
tell theProject
set theOtherTask to make new task with properties {name:"Other Task Name", note:"Other Task Note"}
end tell
-- Create a new tag
set newTag to make new tag with properties {name:"New Tag"}
-- Add `newTag` to `theOthertask`
add newTag to tags of theOtherTask
-- Create a new task with `newTag` in Inbox
set theThirdTask to make new inbox task with properties {name:"A Third Task", primary tag:newTag}
end tell
The following scripts and guides were an enormous help and this guide wouldn't be possible without them: