First of all, this is a big hack and doesn’t work in almost all of the cases. You need to have your OmniFocus set up in a special way to utilize this, but here it is:
How does it work?
This script abuses 2 things:
- The ‘estimated minutes’ field
- The ‘sorting my duration’ setting
When executing, the script identifies the selected task inside the current tree, calculates a ‘estimated minutes’ setting and applies it in batch to all other tasks.
For example you have tasks t1, t2, t3 and t4. When running the script without any setting, the script freezes the current tasks position as it’s estimation. So t1 has a estimation of 0 minutes, t2 of 1 minute and so on.
Because the perspective is sorted by by duration, the task with estimation 0 will always be at the top.
Now when you execute the script to move a task, it sees it’s estimation setting and swaps it with the previous / next task. The perspective sees the change and re-sorts the tasks based on estimation again.
When can I use this?
- You don’t use the estimation field for anything
- You have your perspective set to ungrouped
There are a ton of cases when it won’t work. Any sort of grouping currently breaks the script. It also currently only works with 1 selection at a time. When selecting multiple tasks, it will pick the first one.
Also I am currently forcing focus on one perspective called “Next” since this is my workflow. Please update the script to use your perspective or the currently selected one.
var pName = "Today"; var w = ofDoc.documentWindows(); // swap perspective w.perspectiveName = pName;
How do I use this?
The script contains 3 functions:
down() move the selected task up and down appropriately.
freeze() is then writing the new order to OmniFocus. So you have to execute
freeze() after each
It’s enough to copy the entire thing into the script box and edit the last line to be
Please, if you improve the script consider opening a pull request so we can all benefit from the updates :)