How to move quickly Omnifocus tasks to a date after your vacations or deadlines

I have written in a previous blog post about a quick way to defer tasks in Omnifocus to later today, to the next day, or even to the weekend. I use a combination of AppleScripts and Alfred 2 workflows.

The beauty is, you don't have to know anything about AppleScript nor do you have to have any programming skills to make it work for you!

While I use these workflows everyday, I also have sometimes the need to defer tasks to a specific date instead of a specific week day. For example, when I have vacations coming up, I want to have a clean plate before I leave. All the tasks that I do not have to get done before my vaccations, I want to get out of my way and move them to a point in time when I am back. Another example is when I have a big deadline and I want all the not-that-important projects show up again afterwards.

Tip: Defer your tasks to a date a couple of days after your vacation/deadline. You will need this additional days to go through all your emails that have been piling up in the meantime.

With this little workflow, which can be adapted to your needs super fast and super easy, you can quickly move projects out of your way.

The AppleScript

The original AppleScript I have written takes the selected tasks (can be one or multiple) in Omnifocus, goes through them step by step, and changes the defer dates, and finally cleans up (i.e. refreshing the view, ⌘+K). This is the code:

Make it your Holiday/Deadline AppleScript

Now, let's see how we can change this script to make it your own. It is very easy and you don't need to have any programming skills whatsoever. There is a function at the end of the script called "on myDeferDate()". In there you simply have to define the variables for the day, the month, and the year. Let's assume you want to use the script for your next Christmas holidays and you want to move the tasks to the 6th of January of 2017. Below you can see that currently the date is set to the 30th of December 2015.

example_Jan_6_2017.png

To set the date to 6th of January 2017 we set myDay to 6 and myYear to 2017. The month is a little bit tricky. In AppleScript's date format months are encoded as integer number, i.e. January = 1, February =2,..., December = 12). Therefore, we set myMonth to 1.

As you can see it is very easy to adapt the script. Try it out and make your date.

Test the script in the AppleScript editor

Now let's test it to see if it works. Don't be afraid of screwing up something. However, to be on the safe side, backup your Omnifocus data base before going ahead. Under the file menu there is the possibility to "Move Old Data to Archive...".

Open your AppleScript editor (e.g. by searching for it in Spotlight with "AppleScript Editor"). Make a new file (⌘+N) and copy the code from above into the editor. Press ⌘+K to check for errors and to color code the script.

Make a test task in your Omnifocus inbox and select it. It will be highlighted in light blue – see screenshots below. Now run the script and you should see that the defer date has changed. Doing that from the Applescript editor however is not very convenient. You get the most out of it when you call it via a shortcut. There are many different tools that you can use for that, e.g. Automator, Keyboard Maestro, LaunchBar, or, my tool of choice, Alfred 2.

Define a clever shortcut for it

You can make a very simple workflow, where you define a shortcut – I typically use ⌃⌥⌘+H – to run the script. You can try to make this workflow on your own, or you simply get mine from here. When downloaded double click on the workflow to include it to Alfred. Change the date in the Run Script block and make sure you change the shortcut in the Hotkey block.

It's your turn – Play around and start to use it

As you have seen changing the code is super easy. I usually keep my shortcut the same (⌘+H), but change the underlying defer date every time I have a big deadline or holidays coming up. Also don't worry about screwing up. If you provide values that can't be interpreted as a sensible date (e.g., you set the month value to 13) Alfred and AppleScript are clever enough and nothing is changed at all in Omnifocus.

I am sure you can find more applications for this workflow. I would love to hear from you about them in the comment section. If you want to know more about the original code, you can find the corresponding blog post here.

Work smart, be remarkable, and have a great day!
Helmut