An illustrative draft, in response to a request in the OmniFocus for Mac forum, for a way of setting review interval according to project status.
Requires a filter clause for each type of project. You can experiment with the clauses, to get them right, using the assisted query-editing menus in my Where in OF script.
Requires a filter clause for each type of project. You can experiment with the clauses, to get them right, using the assisted query-editing menus in my Where in OF script.
Code:
-- Ver 0.3 Rob Trew -- Only for OmniFocus 1.8 and above -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -- IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. tell application id "com.omnigroup.omnifocus" -- EDIT THE LINE BELOW TO MODIFY OR ADD CONDITIONS. -- THE CLAUSE OF EACH TRIPLET MUST BE A WELL-FORMED FILTER CLAUSE -- (YOU CAN EXPERIMENT WITH THE CLAUSES, TO GET THEM RIGHT, USING -- THE "WHERE IN OF" SCRIPT AT http:/bit.ly/OF-Find2 ) -- EDIT HERE: ----------------------------------------------------------------------------- set lstCycles to {{"status is on hold", week, 6}, {"status is active", day, 4}} ----------------------------------------------------------------------------- set oDoc to default document tell oDoc repeat with oProjType in lstCycles set {strClause, eUnit, lngSteps} to oProjType set oScript to run script my QueryScript(strClause) set lstProjects to GetProjects(oDoc) of oScript repeat with oProj in lstProjects set review interval of oProj to {unit:eUnit, steps:lngSteps} end repeat end repeat end tell end tell on QueryScript(strQuery) " script on GetProjects(oDoc) tell application id " & quote & "com.omnigroup.OmniFocus" & quote & " tell oDoc to return flattened projects where " & strQuery & " end tell end GetProjects end script " end QueryScript
Last edited by RobTrew; 2012-07-17 at 06:57 AM.. Reason: Typo