Table Selection Detection Deception

Nope, refUITableData is my data that is in the table.

Counting items works just fine. It’s the next line that has the problem.

Coercing is what you need then. Get used to coercing a lot of data when switching from Applescript to Obj-C world.

So just like fiz said:

tell refUITableArrayController to insertObject_atArrangedObjectIndex_(recData, (numRow - 1) as integer)

Here’s a complete script:

script SMSAppDelegate
	property parent : class "NSObject"
	property theData : missing value
	property ac : missing value
	
	on applicationWillFinishLaunching_(aNotification)
		set my theData to {"One", "Two", "Three"}
	end applicationWillFinishLaunching_

	on doInsert_(sender)
		set theCount to ac's arrangedObjects()'s |count|()
		ac's insertObject_atArrangedObjectIndex_("Four", theCount)
	end doInsert_
end script

Thanks! That’s helpful. I replaced my code that was modifying the property containing data and then reloading the table with a delete and insertObject_atArrangedObjectIndex_ and now everything updates as expected. Unfortunately I don’t have time to figure out why modifying the property didn’t also update the table view. Odd… but this was very helpful and allowed me to work through my problem.