Pixelated Header
Template Script Icon OmniFocus Icon

OmniFocus is an incredible piece of software. I and countless others rely on it every day to manage increasingly hectic lives and complex, multi-facetted projects.This script is an effort to reduce one of the largest sources of friction remaining in my OmniFocus setup: maintaining and creating projects that don't recur on even intervals, but occur frequently enough that their planning and capture becomes a time sink.



Download the most recent version of the script (Templates.scpt) from the link above. Once you have downloaded the script, navigate to your Application script folder located at ~/Library/Application Scripts/com.omnigroup.OmniFocus2. Apple hides the Library folder in Mac OS X 10.7 or later by default, so the easiest way to get to this folder is to select the menu item Help > Open Scripts Folder in OmniFocus.

Using the Script

There are countless ways you can run the script. If you are a pro user, you likely know even more ways than I do: options like launching the script from FastScripts, Alfred, LaunchBar, or a Keyboard Maestro macro are all available to you. Below I'll explain two ways to run the script, primarily targetted at more novice users.

Your first option is to run the script from Apple's AppleScript menu. If you don't have a little script icon near the clock in your Mac's menubar, you need to turn this on manually. Open AppleScript Editor.app from your Applications > Utilities folder. Go to AppleScript's preferences by selecting AppleScript Editor > Preferences... from the menubar. On the "General" pane, you should check the checkbox to "Show Script menu in menu bar". Now, when in OmniFocus, select the new script menubar item and you will see the "Templates" script at the bottom of the list, ready to be clicked and run.

OmniFocus has another way to run scripts, and it's even easier than the method described above. Once the script is installed, go to OmniFocus and right- (control-) click on the toolbar (the gray bar at the top of the window that shows icons for your inbox, projects, and more). Choose "Customize Toolbar..." from the contextual menu that pops up. You will then see a list of all items that can be put in your menubar, including (at the bottom) any scripts that you have installed. Drag the "Templates" script anywhere on the toolbar and click "Done". You now have one-click access to run this script!

Script Basics

You need a few things before the script will work as intended. The script looks for a folder that contains the word "Template" in the name, and assumes that this is the folder from which you want to select template projects. The actual template projects can be On Hold (the script will automatically switch the new template instances to Active). If it doesn't find an obvious template folder, it will ask you which folder to use.

When the script runs, it does a number of things. It will first ask you which project inside the template folder you would like to create a new instance of, then ask in which folder you would like to put the new project instance. If there are any variables or "ask" statements (discussed later) the script will prompt you to provide any additional input required.

The Basic Workflow
The basic workflow of the script.

On first run, the script will ask you to choose a variable symbol.

Variable Types

You can use variables in your script to have the script prompt you for a string that will be used in multiple places of the new template instance. For example, a template for contacting someone may use a person's name for a number of tasks/ notes/ context names, and the name to use may change for each project instance. This is an ideal time to use a basic variable. Note that all variables are case-insensitive.

Start/Defer and Due Dates

The script can assign due dates to any subset of tasks in the template projects, or to the project itself. Start/defer dates are set using the phrase start:/defer: in a new paragraph of the project/ task’s note, while due dates are set using due:. Note that no there are many alternate date formats that are not understood (for example, 2013/03/20, 13.03.20, and 3/20). You then include one of the following date declaration types:

Date Workflow
Here, the $DateToCompare is a date variable, from which we add one week to get the start date of the second task. The start: ask in the project yields the right dialog box, where you can enter the desired date. The other dates are calculated based on date math with respect to the project start/ due date.


The script can complete or delete tasks or task groups within the projects contingently (i.e., using an if/else statement). In order to use this feature, you include a conditional statement in the note of the desired tasks/ task groups in the following format: @if $variableName [<=, >=, ==, !=, >, <] comparison then [complete, delete]. You can use a second variable as the comparison if you would like to. The entire statement must be all by itself on a new line in the task note for the conditional statement to work. You can combine multiple comparisons together using either "and" (&&) or "or" (||) keywords (but not both).

The operators are self-explanatory, but are explained here in case you are not familiar with them: >= means equal to or greater than; <= means equal to or less than; == means equal to; != means not equal to; > means greater than; and < means less than. The comparison can be either numbers or strings. The conditionals rely on comparing your comparison amount/ string to one of the project variables, which must be declared in the project note as with any variable.

A few examples conditional statements are shown below:

Conditional Completion and Deletion
A comparison of what happens when the same project with two conditional tasks is instantiated, depending on the input for the $friend and $budgetAmount variables.

Default Folders and Other

You can select a default folder into which to place new instances of a template project. To do so, place the following in a new paragraph of the project note: >>> defaultFolder, where you replace defaultFolder with the exact name of the target folder. For example, >>> Work will place new instances of that template project in the folder whose name is “Work”. You can specify a subfolder to place it in as well, if you have a more complex folder structure: this is done using the symbol > to denote a subfolder. For example, >>> Work > Job1 would place all new instances of the project in the “Job1” folder under the “Work” folder. You can specify any depth you want using this notation.

Advanced Features
The >>>Work in the project note automatically places new instances of the template in the "Work" folder. The $Today variable is automatically assigned today's date.

You can tell the script to ask you whether a task should be deleted by putting delete: ask anywhere in the note. Likewise, you can put complete: ask anywhere in the note to have the script ask you whether or not to complete a particular task in the new instance of the template.

There are a few compile-time options that you can change for this script. If you open the file in AppleScript Editor, changes to the following properties can be made without breaking anything:

Glossary of Commands

Version History