Have you looked in the AppleScript dictionary for the properties of table view? In addition to “selected row” (and many others), it shows another property:
selected data row (data row) : the data row that is selected
and clicking the hyperlinked “(data row)” class gives you its definition, including the property:
contents (any) : the contents of the data row
Putting that together, it means you can:
get contents of selected data row of table view "app_list" in scroll view "al" in window "main"
set theTableView to table view "app_list" of scroll view "al" of window "main"
set selectedDataRow to selected data row of theTableView
set theContent to contents of data cell "Title1" of selectedDataRow of theDataSource
-- "Title1" is the name of the column
display dialog theContent
Heiner
Browser: Safari 525.13
Operating System: Mac OS X (10.4)
neither of your scripts work! @Barefeet
yours gets “Apple Event Failed” (tried in many ways) @Heiner
set theContent to contents of data cell “Title1” of selectedDataRow of theDataSource <-<- where did you get this var from?!?
tried with many thing and got messy errors
theDataSource is the name of the data source you have to attache to the table view (normally in the awake from nib - handler). See: Developer → Examples → AppleScriptStudio → Table Sort and Table !
The example codes are simple and instructiv. Examine the examples exactly, especially ‘Table’; look into the Interface Builder’s MainMenu.nib; there are two examples ‘witout’ and ‘with’ data source; if you take the last one, you have to add a data source to the project (drag from palette ‘AppleScript’ the data source (a blue cube) to the nib-pane and connect it with the table view by ctrl-drag from the table view to the cube, connect it in the inspector pane).
It works here, for me. Maybe your specification of the table doesn’t match your project. Try runing your program, select a row in your table, and run this script in Script Editor:
tell application "My Application Name" -- change this to the name of you program
set theObject to first responder of front window
get contents of selected data row of theObject
--get contents of selected data row of table view "app_list" in scroll view "al" in window "main"
end tell
If that works, try uncommenting the last line. If the last line doesn’t work, then it seems that you’re not correctly referring to your table. Maybe the name is wrong or it’s in another view (eg tab view).
that worked perfectly!
I uncommented the line and it still worked so im not sure what the problem was, im gonna put it into my app and see if it works
thanks!