Make row with level property

Hello. I’m trying to make a row with a level property, so that its indentation is correct. I’m essentially trying to make children by using levels.

The first script below returns “OmniOutliner got an error: AppleEvent handler failed.”

make new row at end of children of last row of front document with properties {topic:note_text, level:2}

Here’s the whole thing:

			set {fav1, fav2, fav3, fav4, fav5, fav6} to favorite colors
		
		if rgba is fav1 then
			tell application id "com.omnigroup.OmniOutliner4" to make new row at end of rows of front document with properties {topic:note_text}
			
		else if rgba is fav2 then
			tell application id "com.omnigroup.OmniOutliner4" to make new row at end of children of last row of front document with properties {topic:note_text}
			
		else if rgba is fav3 then
			tell application id "com.omnigroup.OmniOutliner4" to make new row at end of children of last row of front document with properties {topic:note_text}
			
		else if rgba is fav4 then
			try
				tell application id "com.omnigroup.OmniOutliner4" to make new row at end of children of last row of front document with properties {topic:note_text}
			on error
				tell application id "com.omnigroup.OmniOutliner4" to make new row at end of rows of front document with properties {topic:note_text}
			end try
			
		else if rgba is fav5 then
			tell application id "com.omnigroup.OmniOutliner4" to make new row at end of children of last row of front document with properties {topic:note_text}
			
		else if rgba is fav6 then
			tell application id "com.omnigroup.OmniOutliner4" to make new row at end of children of last row of front document with properties {topic:note_text}
			
		end if

Realize this is old thread but in case anyone else comes along like me trying to figure this out, this is what works on my machine:

To make a new child use “at”:

make new row at last row of front document --> child

To make a new top level row use “at after”:

make new row at after last row of front document --> top level

To make a new sibling use “at” and then outdent:

set newRow to make new row at last row of front document
outdent newRow --> sibling

SG

1 Like

SG - thanks for posting how to create a new row, I have just used your hints while updating a script that copies an email from mail to the open OO document.

Simon