View Single Post
Meanwhile, I created a script that I use to fake it.

I'm taking advantage of the fact that when a project is reviewed, it does update the Changed date - indeed to the exact same time as the Last Reviewed date.

To use this, I make a selection in the sidebar, and run the script. All projects included in the selection will have the Next Review date changed as follows:

- if the last review date and the changed date are exactly the same, do nothing
- if the last review date and the changed date are different, we'll assume the project is "dirty" and needs to be reviewed - so we change the Next Review date to be the same as the Changed date.

The way it is now, since the Next Review date is set to the Changed Date, I see some "review yesterday" and "review within the last week", but this doesn't bother me, it's nice to have the projects that became dirty longest ago near the top. But this has a bit of a quirk - if I run the script a second time, the Next Review date becomes Today - this is because the first time I ran it, the Next Review date is changed by the script, and this constitutes a change, so the changed date is nudged, and that date is used in the second run of the script! A minor annoyance - to make the script behave more consistently I suppose the Next Review date could be set to Now.

Here's the script:

Code:
on run
    tell application "OmniFocus"
        tell front document
            tell document window 1
                
                set selectedTrees to selected trees of sidebar
                -- once I'm more comfortable that this is not causing damage, I'll consider running it on the whole tree in the sidebar.
                             
                repeat with aTree in selectedTrees
                    
                    if class of value of aTree is project then
                        my processProject(aTree)
                    else if class of value of aTree is folder then
                        my processFolder(aTree)
                    end if
                    
                end repeat
                
            end tell
        end tell
    end tell
end run

on processFolder(theFolderAsTree)
    using terms from application "OmniFocus"
        
        repeat with aTree in trees of theFolderAsTree
            if class of value of aTree is project then
                my processProject(aTree)
            else if class of value of aTree is folder then
                my processFolder(aTree)
            end if
        end repeat
        
    end using terms from
end processFolder

on processProject(theProjectAsTree)
    using terms from application "OmniFocus"
        
        set aProject to value of theProjectAsTree
        
        
        set oldReviewDate to last review date of aProject
        set lastChangedDate to modification date of aProject
        
        if oldReviewDate is not equal to lastChangedDate then
            set next review date of aProject to lastChangedDate
        end if
    end using terms from
    
end processProject