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 for returning from focus to overview (http://forums.omnigroup.com/showthread.php?t=17471)

RobTrew 2010-08-21 02:36 AM

Script for returning from focus to overview
 
Returning from focus to overview is such an important movement of the mind, and needs to happen so often, that I find that any friction or obstacle in its path soon becomes quite noticeable.

Drilling down into the [I]Perspectives[/I] menu for [I]All Items[/I] or [I]Revert to Default View[/I] is fine the first dozen times but soon becomes an irritant ...

Placing a default perspective on the toolbar is better, but I find the jump a little abrupt and rigid:[LIST=1][*]Unless I have misunderstood, an OF perspective has to have a particular setting for each drop-down setting on the filter bar - I would like a [B]No Change[/B] option, particularly for grouping and sorting.[*]Mental integration of overview with detail works better for me if I can zoom back in stages, rather than leaping in one bound from the beating heart of the rabbit straight up to the mountain peak - I would like to be able to zoom out with one click for each successive enclosing folder, and then zoom back in progressively to a particular project which I had been attending to.[/LIST]
(It would be possible to write a slightly more gradual zoom with applescript, but it's not a priority for me at the moment - more a thought about how one might design support for integrating focus with the building of overview.)

In the meanwhile, here is a draft of the script which I currently use for "standing back". It differs from clicking on a perspective in two respects:

1. It leaves grouping and sorting settings [B]unchanged[/B] (while setting sidebar and status to "remaining" and clearing the flag and duration filters)
2. It toggles between a indented folder view and a flat project-list view of the sidebar.

(In the Setfilters() function, passing a hyphen to a parameter will leave a filter bar setting unchanged, and setting an empty string will clear it. Otherwise you can pass the relevant applescript identifiers, dropping any "-projects" or "-contexts" suffix).

[CODE]-- For OF 1.8+ only
-- 1. Toggles between folder hierarchy and a flat list of all projects
-- 2. Setting the view to the user's top-level default (here Project view, Remaining Projects, Remaining Tasks)
-- (Sorting and Grouping settings are left unchanged)


tell application id "com.omnigroup.OmniFocus"
tell default document
set oWin to front document window

if selected view mode identifier of oWin is not "project" then
set selected view mode identifier of oWin to "project"

if my IsNarrowed(focus of oWin) then
set focus of oWin to {}
else
set lstProjects to flattened projects
set focus of oWin to lstProjects
end if

my SetFilters(oWin, {"remaining", "-", "-", "incomplete", "", ""}, false)
select tree 2 of sidebar of oWin
end tell
end tell

on IsNarrowed(oFocus)
repeat with oItem in oFocus
return true
end repeat
return false
end IsNarrowed

on SetFilters(oWin, {strSmartGroup, strGrouping, strSorting, strState, strFlagged, strDurn}, blnContext)
if blnContext then
set strClass to "-contexts"
else
set strClass to "-projects"
end if
tell application id "com.omnigroup.omnifocus"
tell oWin
if strSmartGroup is not "" then
if strSmartGroup is not "-" then if selected smart group identifier of sidebar is not strSmartGroup then
set selected smart group identifier of sidebar to strSmartGroup & strClass
else
set selected smart group identifier of sidebar to "all" & strClass
end if
tell content
if strGrouping is not "" then
if strGrouping is not "-" then if selected grouping identifier is not strGrouping then
set selected grouping identifier to strGrouping
else
set selected grouping identifier to "none"
end if
if strSorting is not "" then
if strSorting is not "-" then if selected sorting identifier is not strSorting then
set selected sorting identifier to strSorting
else
if blnContext then
set selected sorting identifier to "context"
else
set selected sorting identifier to "none"
end if
end if
if strState is not "" then
if strState is not "-" then if selected task state filter identifier is not strState then
set selected task state filter identifier to strState
else
set selected task state filter identifier to "all"
end if
if strFlagged is not "" then
if strFlagged is not "-" then if selected task flagged filter identifier is not strFlagged then
set selected task flagged filter identifier to strFlagged
else
set selected task flagged filter identifier to "all"
end if
if strDurn is not "" then
if strDurn is not "-" then if selected task duration filter identifier is not strDurn then
set selected task duration filter identifier to strDurn
else
set selected task duration filter identifier to "any"
end if
end tell
end tell
end tell
end SetFilters
[/CODE]


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

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