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 > OmniOutliner > OmniOutliner 3 for Mac
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
View By Level? Thread Tools Search this Thread Display Modes
Is it just me or is there no capability in OO to restrict an outline view to a specific level - i.e. only show levels 1 through n? Seems pretty basic - even MS does it in Word & Excel. I have a huge 2000+ line outline with 8 levels and it looks to me like I can either expand or collapse it completely or expand selected rows.

Please don't tell me to write a script. If it's easy enough to write a script then it should be really easy for OG to add the capability. Actually I think I just answered my own question - just use MS Word... Doh!
 
You don't have to write a script - it's already been written. Go to Omni's "Extras" page ...

http://www.omnigroup.com/products/omnioutliner/extras/

... and download the "Useful Scripts". Among them you'll find "Collapse to Level X". It will collapse or expand to whatever level you set.
 
Here is a version which can optionally be used with Launchbar.

You can pass a number to it by selecting the script in Launchbar and tapping the space bar to get an entry field.
  • Simple integers will be read as an absolute level of expansion
  • Numbers prefixed by + or - will be interpreted as relative adjustments
  • A simple + will be read as +1 (expand another level)
  • - on its own will be read as -1 (collapse another level)

(This version - unlike the one in the 'Useful Scripts' download - avoids collapsing any hidden levels at deeper levels of nesting, in case reopening them all manually slows thing down during the expansion of particular subtrees).

Code:
property pTitle : "Expand OO3 doc to level N"
property pVer : "0.03"

-- WORKS WITH LAUNCHBAR,
-- give an absolute expansion level, or an adjustment like +1 -2 etc 
-- (a simple + or - is interepreted as +1 or -1)
on handle_string(strLevel)
	tell application id "OOut"
		set lstDocs to documents
		if length of lstDocs < 1 then return
		my ShowLevel(strLevel, item 1 of lstDocs)
	end tell
end handle_string

-- OR WITHOUT LAUNCHBAR ...
on run
	tell application id "OOut"
		set lstDocs to documents
		if length of lstDocs < 1 then return
		set oDoc to item 1 of lstDocs
		
		set lngMax to count of level styles of oDoc
		activate
		set varLevel to (display dialog "Level to expand to (1-" & lngMax & ")" & return & return & 
			"(or amount to adjust expansion by: +1 -2 etc)." default answer lngMax buttons {"Cancel", "OK"} 
			cancel button "Cancel" default button "OK" with title pTitle & "  ver. " & pVer)
		set varLevel to text returned of varLevel
		my ShowLevel(varLevel, oDoc)
	end tell
end run

-- What is the level of the highest node which is currently collapsed ?
on GetLevel(oDoc, lngMax)
	tell application id "OOut"
		tell oDoc
			set lngMin to lngMax
			set lstLevels to level of rows where expanded = false and has subtopics = true
			if length of lstLevels = 0 then return lngMax
			repeat with oLevel in lstLevels
				if oLevel < lngMin then set lngMin to contents of oLevel
			end repeat
			return lngMin
		end tell
	end tell
end GetLevel

-- Set an absolute expansion level, or adjust the expansion level by a delta
on ShowLevel(strLevel, oDoc)
	tell application id "OOut"
		set blnPlus to strLevel contains "+"
		set blnMinus to strLevel contains "-"
		set blnDelta to (blnPlus or blnMinus)
		try
			set lngValue to strLevel as integer
		on error
			if not blnDelta then
				activate
				display dialog strLevel & " could not be interpreted as a level or adjustment" buttons {"OK"} default button "OK" with title pTitle & "  ver. " & pVer
				return
			else
				if blnMinus then
					set lngValue to -1
				else
					set lngValue to 1
				end if
			end if
		end try
		
		tell oDoc
			set lngMax to count of level styles
			lngValue
			if blnDelta then
				set lngLevel to (my GetLevel(oDoc, lngMax)) + lngValue
			else
				set lngLevel to lngValue
			end if
			if lngLevel > lngMax then set lngLevel to lngMax
			if lngLevel > 0 then
				set expanded of rows where level < lngLevel to true
				set expanded of rows where level = lngLevel to false
			else
				set expanded of rows to false
			end if
		end tell
	end tell
end ShowLevel

Last edited by RobTrew; 2012-10-22 at 07:34 AM..
 
Quote:
Originally Posted by TheSteveW View Post
Actually I think I just answered my own question - just use MS Word... Doh!
May be worth bearing in mind that MS Word outlines have a maximum depth of 9.

(OmniOutliner and OmniGraffle allow for arbitrary depths of nesting, if you need them).
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
View-level between Available and Remaining macmath OmniFocus 2 for Mac (Private Test) 0 2013-04-03 08:24 PM
View only certain level(s) of headings John Laudun OmniOutliner 3 for Mac 4 2011-09-04 07:31 PM
Top level items lost [A: Groups aren't actions, don't show in context view.] flyklr OmniFocus 1 for Mac 1 2009-10-06 05:09 PM


All times are GMT -8. The time now is 12:08 PM.


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