Why is there a new OmniFocus library?
Put omnifocus.scpt in
~/Library/Script Libraries, or else AppleScript won’t know where to find it!
use application "OmniFocus" use O : script "omnifocus" tell O set sel to selectedItems() deferDaily(sel) # this will set all the selected tasks to start again after completion daily setDefer(sel, current date) set theTask to findTask("Log food") # find the first task whose name is "Log food" set theProject to findProject("Groceries") set theContext to findContext("Home") set theFolder to findFolder("Routine") # Parse using transport text (see below for details) parse("Do something! @home ::misc #5pm #tomorrow //This is a note") end
For those who don’t know about transport text, it’s a format that OmniFocus uses to parse task information like so:
Do something! @home ::misc #5pm #tomorrow //This is a note
Do something a flagged task.
@home sets the context to “home”.
:: is used for matching a project. Both
:: will fuzzy match existing contexts and projects. The first
# is used for a defer date, while the second
# is for a due date. Both support natural language parsing like the inspector in OmniFocus. Word of caution though, if only one
# is present, OmniFocus assumes it’s a due date. Lastly,
// starts the note for a task. While more involved ways of creating OmniFocus tasks exist in the library, you’ll find using
of.parse as your primary means of creating tasks.
- setDue(input, dueDate)
- setDefer(input, deferDate)
- setProject(input, projectName)
- setContext(input, contextName)
- namePrepend(input, prependString)
- nameAppend(input, appendString)
- setComplete(input, booleanFlag)
- setSequential(input, booleanFlag)
- setRepeat(input, repetitionRule)
- clearContainer(input) # Only works on inbox tasks
- setPrefix(input, prefix)
- clearPrefix(input, prefix)