polishing ruby by ryan davis

Omnifocus Scripts

Published 2012-05-23 @ 12:00

This is my eighth entry detailing my personal “productivity pr0n”.

I use my applescript menu a lot. I use it to clean up my messy windows, to go to bed, and to do my day to day task organization. I have several scripts for omnifocus that help me do basic planning:

Omnifocus has a nice feature that lets you turn any of those omnifocus applescripts into toolbar buttons making it much faster and easier to apply them to selected tasks:

omnifocus script bar

Below are basic descriptions of the scripts I use on a regular basis. Please let me know if you’d like any of them.

omnifocus script menu

Defer

Defer takes the selected tasks and shifts their start and due dates by a user defined number. You can specify positive or negative numbers and it will shift them either direction. Defer doesn’t take day of week into consideration so you can shift things into the weekend.

I use this whenever I need to balance tasks out through the week or I know I can’t (or won’t) get something done today.

Skip

Skip filters on the selected repeating tasks, marks them as done, and then deletes them. Marking them as done will cause the following repeating task to be created, and deleting them means that they won’t show up in your completed view so they won’t dilute your actual work done.

I use this all the time when I have releases scheduled but there was no work on that project in the last cycle.

Stagger Dates

Stagger Dates takes the selected tasks and redistributes them one weekday at a time. For example, if it is Monday and you select 5 tasks and hit Stagger Dates, you’ll have one task on each day of the week. If it is Tuesday, then you’ll have 4 for this week and 1 on next Monday.

I use this when I plan a sequence of tasks (like all these blog posts) and want to only do one a day. I also use in when after a big reorg I have a ton of tasks on a single day. This quickly balances out tasks without having to edit them all by hand.

Stagger Times

Stagger Times does the same thing as Stagger Dates, but for a single day. It takes the selected tasks and reschedules each task to start at the end of the previous task based on the previous due time and the estimated time of the task.

This lets me throw everything to a single day (which will use the default due time) and then spread them out throughout the day. If the tasks go too late, I know I’ve bit off more than I can chew for that day.

Followup

Followup takes the currently selected task, duplicates it, prefixes with “Followup: “, and then schedules it for a week out. It makes sure that the repeat interval and the completed checkbox are both cleared in the followup.

I use this whenever my portion of a task is done, but I’m depending on someone else as well.

Fix Start Dates

Fix Start Dates takes the selected tasks and makes sure that the Start Date is filled in to the same day as the Due Date, if any. It also goes the other direction too, but I need that a lot less often.

I use this whenever I’ve written up a bunch of tasks en masse and given them due dates. Having a start date in the future gets the tasks off my radar until I need to pay attention to them.

Making Your Own

It is actually pretty easy to make your own scripts and the basic structure of the script is almost always the same:

tell application "OmniFocus"
  set will autosave of front document to false

  tell content of front document window of front document
          set validSelectedItemsList to value of (selected trees
where class of its value is not item and class of its
value is not folder)

          repeat with thisItem in validSelectedItemsList
                  -- do something with each task
          end repeat
  end tell

  set will autosave of front document to true
end tell

Some notes about this:

ETA: For now I’ve put my scripts up on my server in a zip file. I’m trying to figure out how to properly package these up in the omnifocus gem.