Applescript - trouble adding a row


#1

I cobbled together a simple script that lets me append a row to an omnioutliner document and I’ve got to say it seems to work pretty well. My only issue is that if the document is open when the row is appended to the document, the new row appears at the top of the document, instead of the bottom.

This appears to be a graphical error of some kind as if I close the document and reopen it the row is properly positioned on the bottom.

I can’t tell if there’s something I’m doing wrong or if I should report this to the devs.

I’m using the “make new row with properties” to append my row.

Thanks for any help anyone might be able to provide.


#2

You have to tell it where to make the new row. Some examples:

tell document 1
	
	make new row at last child
	make new row at row 4
	make new row at row -1
	
set miscRow to row "Miscellany"
	make new row at (end of child of miscRow)

Hope this helps.


#3

Thanks so much!

This gives me a lot more to think about.

You wouldn’t happen to know the code to add the row to the end of the document as a level 1 row would you?

“Make new row at last child” is making a level 2 row, and “make new row at last parent” is throwing me up an error. It’s definitely helping me to head in the right direction though.


#4

You can add an after. Try:

make new row at after last row

#5

That seems to’ve done it!

Thanks so much!