In my haste to learn Applescript, and apply it to OO, I didn’t check to see if this was a core function. I checked the default Find Window, and although I didn’t see it there it doesn’t rule out the possibility that I’ve missed it somehow.
This script will take your query and search the text of the topic cells for a match. On finding a match it collapses all rows not containing the query, and then selects the rows which do.
set query to the text returned of (display dialog "Enter Your Search Term" default answer "QUERY" with title "Search OmniOutliner Front Document" with icon path to resource "OmniOutliner.icns" in bundle (path to application "OmniOutliner"))
tell application id "OOut"
try
set doc_name to name of front document
on error
activate
display dialog "No Document Open"
end try
set the_result to {}
set every_row to every row of front document
repeat with r in every_row
set row_text to text of topic cell of r
if query is in row_text then
set end of the_result to r
collapseAll rows of front document
end if
end repeat
repeat with i in the_result
set the_ancestors to the ancestors of i
repeat with j in the_ancestors
set expanded of j to true
end repeat
end repeat
set index of window 1 where name contains doc_name to 1
activate window 1
if the_result is {} then
activate
display dialog "The word " & query & " was not found." with icon path to resource "OmniOutliner.icns" in bundle (path to application "OmniOutliner")
else
tell front document to select items of the_result
end if
end tell