NSTable Questions - Thanks in Advance

Hello there, as whenever I hit a stone wall and cannot go up, over, or around it, I come begging to the applescript forums. I am designing an application with a NSTable in it. The table will show a list of files in a certain folder, and will allow the user to manipulate the files in that folder. I can get all the file names and paths and such to appear in the table, however, I am unsure of how I can…

…allow the user to click on one of those names (highlight it) and then either a. double click it and/or b. click a seperate button to call a different fuction where the name they have highlighed would be a variable. Basically, how I can turn a value in the table into a variable I can use. I have started with stuff I’ve pieced together here:

on selection changed theObject
	if name of theObject is "scrolling view" then
		set theWindow to window of theObject

		set selectedDataRows to selected data rows of theObject
		if (count of selectedDataRows) = 0 then
			my clearDataVariable(theWindow)

			set enabled of button "play" of theWindow to false
			my setDataVariable(theWindow, item 1 of selectedDataRows)
			set enabled of button "play" of theWindow to true
		end if
	end if
end selection changed

on setDataVariable(theWindow, theRow)
	tell "Finder"
		display dialog "Something is working"
	end tell

end setContactInfo

Hi Deepee,

here an example how to handle double clicks

on double clicked theObject
	set r to selected row of theObject
	set selectedItem to (content of data cell 1 of data row r of data source of theObject) -- assuming the relevant data is in the first column
	my processSelection(selectedItem)
end double clicked

and similar for choosing the selected row with an external button click:

on clicked theObject
	tell table view "tv" of scroll view "sv" of window "main"
		set r to it's selected row
		set selectedItem to (content of data cell 1 of data row r of data source of it)
		my processSelection(selectedItem)
	end tell
end clicked