I use flags to give me a view of my work due/deferred today so I can group by project given I have usually have multiple tasks for specific projects I’m working on. I have used the pull deferred tasks to get any missed tasks caught up. Just wanted to see if anyone had a script that would wipe out all current flagged tasks and then flag all of today’s due and deferred tasks.
So I cobbled together something that finally works. I thought I’d share back in case other folks could find this useful.
Script does 4 things to get my day prepped up:
Removes all tags from existing tasks
Runs the Deferred Items Pull Forward script
Runs the Due Items Pull Forward script (simply updated the deferred items script)
Flags all items that are either due or deferred Today
I use a Today perspective that looks at my “Work” folder which groups my daily items by project. (if the Forecast view grouped by project I wouldn’t need this) I can easily then re-forecast items or unflag items to get to my daily list. I did all this manually before but this now makes the process easy. There are likely much cleaner ways to code this. I cobbled this together from a bunch of posts.
tell application "OmniFocus"
tell default document
set flaggedTasks to (flattened tasks whose flagged is true and completed is false)
repeat with f in flaggedTasks
set f's flagged to false
end repeat
end tell
end tell
run script "/Users/<username>/Library/Application Scripts/com.omnigroup.OmniFocus2/Deferred Items Pull Forward.scpt"
run script "/Users/<username>/Library/Application Scripts/com.omnigroup.OmniFocus2/Due Items Pull Forward.scpt"
tell application "OmniFocus"
tell default document
set todayDate to current date
set todayDate's hours to 0
set todayDate's minutes to 0
set todayDate's seconds to 0
set tomorrowDate to todayDate + 1 * days
set todaysTasks to (flattened tasks where completed is false and ((defer date ≥ todayDate and defer date < tomorrowDate) or (due date ≥ todayDate and due date < tomorrowDate)))
repeat with t in todaysTasks
set t's flagged to true
end repeat
end tell
end tell