Script: Copies selected text, converts to titlecase, pastes into OO as new row

OmniForum won’t let me link to github, but you can search for DrLulz there to see with better viewer.

tell application "System Events" to keystroke "c" using {command down}
-- if OO document is minimized unminimize
tell application id "com.omnigroup.OmniOutliner4"
	if miniaturized of front window is true then
		set miniaturized of front window to false
	end if
end tell
-- send clipboard text to handler
set txt to the clipboard as text
set txt_capped to titlecase(txt)
-- identify current row, make new row from clipboard, then select the new row
tell front document of application id "com.omnigroup.OmniOutliner4"
	activate --comment out to keep focus on copied text
	set parent_row to «class OOpa» of last «class OOsr»
	make new «class OOrw» with properties {«class OOtp»:txt_capped} at end of parent_row -- change "txt_capped" to "txt" to remove titlecase
	«event OTREisal» «class OO+s» of last «class OOsr»
end tell
-- capitalize first letter of each word
on titlecase(txt)
	return do shell script "python -c \"import sys; print unicode(sys.argv[1], 'utf8').title().encode('utf8')\" " & quoted form of txt
end titlecase