UI Scripting Problem

Hello all, I am trying to script Omnioutliner to sort a hoisted outline. As far as I can tell this is not supported via Applescript (If someone know different please let me know). So I resorted with a friends help to UI Scripting. The below code works great if I run it from within Script editor or from the the Fastscripts menu bar. Omnioutliner has the ability to put a script on the tool bar and run a script from within the application if you will. When I do that the script crashes, saying that it can’t get the menu bar item.

Any ideas or points in the right direction would be appreciated:

tell application “OmniOutliner Professional”
tell front document
repeat with theRow in every row
if level of theRow is 1 then
set theTopic to the topic of theRow
if theTopic does not start with “—” then

				hoist theRow
				tell application "System Events" to tell application process "OmniOutliner Professional" to tell menu bar 1 to tell menu bar item "Reorganize" to tell menu 1 to tell menu item "Sort Hoisted Outline" to tell menu 1 to tell menu item "Due Date, Earliest to Latest" to click
				
			end if
		end if
	end repeat