Content of Textfile to table view

Hello,

what I want to do is to to read out a textfile (delimitered by return) and add the list to a table view that has any item in one row.

Everything is fine, if I put the text in a text view, but with the table I have some problems. What am I doing wrong?


on clicked theObject
	if theObject is equal to button "import" of window of theObject then
		set kara_file to open for access (choose file)
		set kara_text to (read kara_file)'s paragraphs as list
		repeat with i from 1 to number of items of kara_text
			tell data source of table view "view" of scroll view "view" of window of theObject
				set kara_line to make new data row at end of data rows
				set contents of data cell "view" of newLine to kara_text
			end tell
		end repeat
	end if
end clicked

thx - ph

This should work (assuming you’ve named your table & scroll view appropriately and have already initialized the data source with a single data column):

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

Thank you, will try that on monday. Is your way only a shorter and easier way or is it necassary to use it this way because it’s a document?

Have a nice weekend! - ph

It is working very well. Thank you.

Do you know a good place to get further information about open/save documents?