The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Script to jump from inbox to project (http://forums.omnigroup.com/showthread.php?t=7438)

RobTrew 2008-03-08 05:12 AM

Script to jump from inbox to project
 
In response to a [URL="http://forums.omnigroup.com/showpost.php?p=32620&postcount=1"]post[/URL] 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.

[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
[/CODE]

Craig 2008-03-08 10:14 AM

Cool script, Rob - works for me.

If you or anyone is thinking of developing this any further, some kind of beep or feedback when no project has been assigned would be an improvement -- or even better, how about it beeps and places the cursor in the project column?

Also, is there a way to further alter the appearance of the new window? A smaller window with no toolbar and no tree pane would be still handier in my opinion.


All times are GMT -8. The time now is 05:48 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.