In response to a post on the Omnifocus general forum, here is a draft script which works when an inbox item (which already has an assigned project) is selected.
It opens up a new window, which focuses on the Inbox and the assigned project. One can then drag and drop inbox tasks to the appropriate points in the project list.
[If the selected task is not in the inbox, the script creates a window which focuses on the parent project]
To install, you could save the script from the Script Editor to ~/Library/Scripts/Applications/Omnifocus under your user folder,
and then choose View/Customize_Toolbar from the Omnifocus menu. This will enable you to drag the script onto the toolbar.
It opens up a new window, which focuses on the Inbox and the assigned project. One can then drag and drop inbox tasks to the appropriate points in the project list.
[If the selected task is not in the inbox, the script creates a window which focuses on the parent project]
To install, you could save the script from the Script Editor to ~/Library/Scripts/Applications/Omnifocus under your user folder,
and then choose View/Customize_Toolbar from the Omnifocus menu. This will enable you to drag the script onto the toolbar.
Code:
tell application "OmniFocus" tell window 1 try set lstTrees to selected trees of content on error return end try if (count of lstTrees) > 0 then set oValue to value of item 1 of lstTrees if class of oValue = task then set idTask to id of oValue set oProj to containing project of oValue tell front document of application "OmniFocus" set winFocus to make new document window with properties ¬ {selected view mode identifier:"project", search term:""} end tell tell winFocus set focus to {oProj} tell sidebar to select library repeat with oItem in trees of content my Expand(oItem) end repeat tell content select leaf id idTask end tell end tell else if class of oValue = inbox task then set idTask to id of oValue set oProj to assigned container of oValue if class of oProj = project then tell front document of application "OmniFocus" set winFocus to make new document window with properties ¬ {selected view mode identifier:"project", search term:"", focus:{oProj}} end tell tell winFocus tell sidebar select every leaf end tell tell content select leaf id idTask end tell my Expand(last item of trees of content) end tell end if end if end if end tell end tell on Expand(oTree) using terms from application "OmniFocus" set oSubTrees to trees of oTree if (count of oSubTrees) > 0 then set expanded of oTree to true repeat with oSubTree in oSubTrees Expand(oSubTree, true) end repeat end if end using terms from end Expand
Last edited by RobTrew; 2008-03-12 at 12:19 PM.. Reason: Update code