Something simple driving me crazy

I’m not a total newbie to programming, applescript or xcode (I used to use RealBasic), but I don’t have a lot of experience with table views. Rediscovering Macscripter.net as well. I’m doing a simple search of one column in a table. The code is below.

set theWindow to window 1 of theObject
	set customersDataSource to data source of table view "customers" of scroll view "customers" of tab view item "customersTab" of tab view "topTabs" of theWindow
	
	-- set the text to compare nameList to
	set searchCustomers to contents of text field "searchField" of window "main"	
	
	set nameList to (contents of data cell 1 of every data row of customersDataSource)
	
	--find out if a name is in the list
	
	if searchCustomers is in nameList then
		display dialog "There's a Match"
		
	else
		display dialog "No Match"
	end if

This works as far as showing the dialog box for testing purposes, but what I’d actually like it to do is select the row that contains the name that matches the name being searched for. I would imagine that it’s a matter of simply saying something like…set clicked row of “whatever” table view etc. or set highlighted of row “whatever”, but I can’t seem to get the context right. Course I had two toddlers “helping” me so it wasn’t exactly easy to think. :rolleyes:

Any help would be much appreciated and I’ll try to contribute to the board when I can.

Thanks in advance,
Twitch

Hi Twitch,

I’m not on a Mac right now, so can’t give you any code. But this script from code exchange should help you a long way.

Much obliged for the quick reply, Stadsman. :slight_smile: I’ll check out that script and let you know how it turns out.

Thanks again,
Twitch