data source variable is not defined

I am having a problem getting my table view data source to work. I am interested in a fix but a reason why would be useful as well. I am new to applescript studio… and if you see something in my code that is stupid that would be halpful too. … and thanks in advance.


on awake from nib theObject
	
	set loginPanel to window "Login"
	display loginPanel attached to window "Main"
	
	--end if
	
	--############ set variables
	set shortname to do shell script "whoami"
	tell application "Finder"
		set startupDiskName to (name of startup disk)
	end tell
	--########### make some aliases
	
	set theFile to (startupDiskName & ":Users:" & shortname & ":Library:Preferences:SpellingTeacherPrefs:users.txt") as alias
	
	--########### get user file data
	
	open for access theFile
	set theData to read theFile using delimiter return
	close access theFile
	
	set makeRows to {}
	
	set text item delimiters to tab
	repeat with i from 1 to count of theData
		set theLine to text items of item i of theData
		copy theLine to the end of makeRows
	end repeat
	set text item delimiters to ""
	
	--return makeRows
	
	set theColumns to ""
	repeat with i from 1 to count of makeRows
		set theColumns to theColumns & " " & item 1 of item i of makeRows & return
	end repeat
	
	--return theColumns
	
-- problem code below[color=red]
	set cell_values to theColumns
	tell theObject
		set theDataSource to data source of table view "users" of scroll view "users"
		tell theDataSource
			make new data column at the end of data columns with properties {name:"student"}
			repeat with cell_value in cell_values
				set theRow to make new data row at the end of data rows
				set contents of data cell "student" of theRow to ((contents of cell_value) as string)
			end repeat
		end tell
	end tell[/color]
end awake from nib

I’m not sure, but… Have you created a data source in Interface Builder and connected it to the related table?

I checked what I have done. I am still at a loss. I have put it so that it can be downloaded. I figure it is easier to look than my inept way of explaining.

http://65.68.188.177/ass/spelling-applescript.zip

I did not have the data source referenced far enough it was:


set theDataSource to data source of table view "users" of scroll view "users"

it needed to be:


set theDataSource to data source of table view "users" of scroll view "users" of window "Login"

on a added note I just figured out how to print to the console with “log” what a time saver

So, when you stated “tell theObject” in your original code, “theObject” was not the window “Login”?

for some reason it was looking for a window named “users”