The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniOutliner 3 for Mac (http://forums.omnigroup.com/forumdisplay.php?f=9)
-   -   View By Level? (http://forums.omnigroup.com/showthread.php?t=26450)

TheSteveW 2012-10-21 12:12 PM

View By Level?
 
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!

rogbar 2012-10-21 02:57 PM

You don't have to write a script - it's already been written. Go to Omni's "Extras" page ...

[url]http://www.omnigroup.com/products/omnioutliner/extras/[/url]

... and download the "Useful Scripts". Among them you'll find "Collapse to Level X". It will collapse or expand to whatever level you set.

RobTrew 2012-10-22 05:51 AM

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.
[LIST][*]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)[/LIST]
(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
[/CODE]

RobTrew 2012-10-22 05:56 AM

[QUOTE=TheSteveW;116395]Actually I think I just answered my own question - just use MS Word... Doh![/QUOTE]

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).


All times are GMT -8. The time now is 12:03 AM.

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