I set the scipt to a shape:
tell application "OmniGraffle"
tell canvas of front window
set lstLayers to (layers of it) as list
repeat with i from 1 to number of items in lstLayers
set this_item to item i of lstLayers
-- insert actions here
set visible of this_item to false
if name of this_item contains "root" then
set visible of this_item to true
end if
end repeat
end tell
end tell
set visible of self to true