Add items to NSTableView in XCode/Applescript

I have added an NSTableView to a form in Interface Builder. It is within a tab view item. I am trying to add items to the table view but it is not working. This is the code I am using:

set thetableView to table view "tableview1" of scroll view "scrollview1" of tab view item "Status" of tab view "tabs" of window "mainwindow"
set content of thetableview to {"Hello","World"}

When I compile I get the following error:

I don’t know what’s wrong, can anybody help?


Try setting the “contents”, rather than the ‘content’.

set contents of thetableview to {"Hello","World"}

For some objects, the two are functionally interchangable, but for others there is a difference in what is returned. Also note that the ability to set the contents of a table in this way was introduced in 10.4, so if you’re still on 10.3 this syntax will never work.


Thanks for your reply, unfortunately your suggestion doesn’t work. I get the same error. I even get the error if I do this:

display dialog name of thetableview


I have sorted it, by using a tell statement:

tell tab view item "today" of tab view "tabs" of window "mainwindow"
	set contents of table view "table1" of scroll view "scroll1" to doList
end tell

I don’t see why it makes a difference, but it works!