Awesome Open Source
Awesome Open Source

OmniFocus 3 AppleScript Guide

Index of classes, properties, commands, qualifiers

Classes

  • task[s]
  • project[s]
  • folder[s]
  • tag[s]

Properties

Task properties

  • name (string)
  • note (string)
  • primary tag (tag) (creation only)
  • tags (list of tags) (modification only)
  • flagged (boolean)
  • completed (boolean)
  • creation date (date)
  • start date (date)
  • defer date (date)
  • due date (date)

Project properties

  • name (string)
  • note (string)
  • singleton action holder (boolean)
  • sequential (boolean)
  • creation date (date)
  • start date (date)
  • defer date (date)
  • due date (date)

Folder properties

  • name (string)

Tag properties

  • name (string)

Commands

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

Qualifiers

  • (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 hierarchy

Examples

tell 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

References

The following scripts and guides were an enormous help and this guide wouldn't be possible without them:


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
applescript (94