Another nifty Script

Brian C. dvorak at omnigroup.com
Fri Feb 28 16:52:03 PST 2003


If you're a parent and have no unchecked children, collapse.
If you're a parent and have unchecked children, expand.

Also surprisingly useful.

> tell application "OmniOutliner"
> 	tell front document
> 		if isStatusVisible then
> 			try
> 				set totL to 0
> 				-- cheezy list initialization hack
> 				set levelList to (first row of document as list)
> 				set deepestLevel to 1
> 				repeat while levelList is not {}
> 					set levelList to (every row where level is deepestLevel) as list
> 					repeat with thisItem in levelList
> 						if (has subtopics of thisItem) then
> 							if (state of thisItem is equal to checked) then
> 								set expanded of thisItem to false
> 							else
> 								set expanded of thisItem to true
> 							end if
> 						end if
> 					end repeat
> 					set deepestLevel to deepestLevel + 1
> 				end repeat
> 			on error errormessage number errornumber
> 				display dialog errormessage buttons {"OK"} default button 1
> 			end try
> 		else
> 			display dialog "Status Checkboxes must be visible to use this 
> script." buttons {"OK"} default button 1
> 		end if
> 	end tell
> end tell
>

Sincerely,

Brian C.
Support Manager
Omni Group




More information about the OmniOutliner-Users mailing list