I primarily use the forecast tab, and especially the Today frame, to manage my workflow. I use defer dates as when I can start working on a task, and due dates as when that task needs to be finished by. I want to see all the due today tasks at the top, then deferred tasks (aka ones that I can be working on) underneath that.
The way OF2 is built, the Today frame shows first tasks that are due today, then underneath that tasks that have been deferred to today. This means that a task with the same due date and defer date will appear twice under Today. While it’s just cosmetic, I do find it distracting to have tasks “doubled up”. The worse part is that if a task has a defer date that isn’t today, it doesn’t appear under the Today section. So if a task has a defer date of December 2, I’ll see it in the Today frame on the 2nd but then it disappears again on the 3rd. Since I use defer dates as start dates, I need a task to always show up under Today once it reaches its defer date.
Therefore, I’ve been trying to make a script and automatically run it at midnight every day to deal with these issues. I need it to A) update any past defer dates to the current date. This way, once I reach the start date for a project it will always show up under the Today frame. I also need it to B) delete any task’s defer date once it reaches its due date. This way, a task won’t appear twice under the Today frame once it’s due.
I found a basic script online that started to get at what I want, but I’ve been building on top of it. It does successfully update past defer dates to the present date, but I can’t seem to make it delete the defer date once it matches the due date. Below is the latest version of code that compiles and runs without producing an error message. Can anyone tell me where I might be going wrong? Thanks in advance!
on run tell application "OmniFocus" set todayDate to current date set todayDate's hours to 0 set todayDate's minutes to 0 set todayDate's seconds to 0 -- loop through all hours of day repeat with hours from 0 to 23 --loop through all minutes of hour repeat with minutes from 0 to 59 -- if a task's defer date is before today, update it to today's date tell default document set todayTasks to (flattened tasks where ((defer date < todayDate) and (completed is false))) repeat with t in todayTasks set t's defer date to todayDate end repeat end tell -- if a task is due today, delete its defer date tell default document set dueTasks to (flattened tasks where (due date is equal to todayDate) and (completed is false)) repeat with t in dueTasks set t's defer date to missing value end repeat end tell end repeat end repeat end tell end run