Populate Template Placeholders

create customized copies of common projects

Download version 0.8.1.

This script takes an OmniFocus project, replaces placeholder text with user entered strings, and adjusts all dates by some fixed interval to match a new start or due date that you enter. The new project appears at the end of your projects list. From there you can move it to the folder you want it to “live” in, or even move it into an existing project as a new action group.

Installation

It takes just three steps to add the script to your OmniFocus toolbar:

  1. In OmniFocus, choose Help → Open Scripts Folder.
  2. Drag the Populate Templates Placeholder file into the scripts folder.
  3. Control-click the toolbar and choose Customize Toolbar to add the script to the toolbar in OmniFocus.

Running

To use, first you need to create a project template in OmniFocus. I use a top-level folder named Templates, marked dropped1, to hold my templates. Here is an example template:

Screenshot of sample template projects

Creating Your Own Template

  1. Create a project with actions for the steps you need to take each time you do the project. The example above lists the steps that I need to take when preparing to attend a conference and after I get home.
  2. Look for common words and phrases that will change each time you do the project. These will become placeholders. In the example above, «ConferenceName» and «ConferenceCity» are my placeholders. The script will replace placeholders with project-specific text when the template is populated. Placeholders are phrases without spaces, surrounded by double-angle quotation marks (also know as guillemets). On a US keyboard this punctuation can be typed with Option-\ and Option-Shift-. The placeholder markers can be changed by editing properties in the script.
  3. Next, list all of the placeholders in the last line of the note field of the project. In the example, you’ll see “«ConferenceName» «ConferenceCity»”. This allows the script to determine what values to prompt you for.
  4. If desired, set defer and due dates for the project and for any items within the project. Dates will be adjusted when the template is populated. Note, the project must have a defer or due date (or both) or the script will not set dates on the actions.2
  5. You can add a line to the note that begins “Due date is”. If that line is present, the script will include the line when prompting you for the new project’s due date. Note, the Due date is line must come before the placeholder line in the note.

Populating Your Template

Now when you’re ready to start a new project using your template, just follow these steps:

  1. Select the root item of the template project. In the example, that’s the “Attend «ConferenceName»” row.
  2. Click the icon for the script in the OmniFocus toolbar.
  3. When prompted, enter values for each of the placeholders.
  4. When prompted, enter a new defer or due date from the project.
  5. The script will create a duplicate of the project template with placeholders and dates filled it.
  6. Drag the new project to the proper place in your system.

1 In what could be considered a bug, projects inside dropped folders are not moved to the OmniFocus archive. However, such projects are also not shown in lists of active projects. So, keeping a template project in a dropped folder is a convenient way to hide the project in most lists while still keeping it around.

2 Gory details on dates:

When the template is copied to make a new project, all the dates are moved forward by the slip time if it exists. If it doesn’t exist, then no dates are changed.