The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Script for returning from focus to overview Thread Tools Search this Thread Display Modes
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 Perspectives menu for All Items or Revert to Default View 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:
  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 No Change option, particularly for grouping and sorting.
  2. 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.

(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 unchanged (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

Last edited by RobTrew; 2010-08-21 at 02:43 AM..
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Returning User down8ve OmniWeb Feature Requests 0 2011-10-15 02:20 PM
Continuous/returning tasks Esparza OmniPlan General 0 2011-01-11 05:44 AM
Returning to default perspectives? ghoetker OmniFocus 1 for Mac 1 2010-11-28 07:50 PM
Returning to no folders hypotyposis Applying OmniFocus 28 2010-10-05 04:23 AM
Script: Focus on Current Selection jeremydb OmniFocus Extras 3 2009-06-29 10:04 AM


All times are GMT -8. The time now is 08:35 AM.


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