Populate a column with data from a file

Hi,

What I am trying to do is read a file in AppleScript - fine - and then load that data into a column of a tableview in AppleScript Studio.

The data in the file is in the form of a simple list (written out from another AppleScript). Do I need to write the file as a ‘property’ ? (and how would I do this?)

The ‘Append’ doesn’t seem to work. Any help is greatly appreciated!

Hi,

I hope I’m understanding your question properly.

You have a text file with a list. i.e.
Item 1
Item 2
Item 3

You want to populate a single column tableview with paragraph 1 in row 1 of the table and repeat with as many paragraph/list items

--read the text and return as text
set f to choose file
set fRef to (open for access f with write permission)
set myTextList to read f
close access f
return myTextList as text

--use paragraphs as as list within a repeat and populate the table
	set theSource to data source of table view "mytable" of scroll view "mytable" of window "main"
	tell theSource
			make new data column at end of data columns with properties {name:"Colname"}
	end tell
	repeat with i from 1 to (count paragraphs myTextList)
		tell theSource
			set theRow to make new data row at the end of the data rows
			set contents of data cell "Colname" of theRow to (paragraph i of myTextList as text)
		end tell
	end repeat

Let me know if this helps…

Joe