Return Text Cell Value as property

How would I go about returning the value of a selected cell on a button press?

I have a table view with a list of times in it.

I would like to select one of the values and then on a button press make quicktime go to that value

I know how to do the Quicktime scripting I just need to get the value from the table view

I am currently trying this

with time being the table column containing the values I need to select

property ThisEntry : time's representedObject
	
	on GoTo_(sender)
        
        
        tell application "QuickTime Player"
            set ToTal to get current time of document 1
            if document 1 is playing then
                step backward document 1 by ToTal * 4
                step forward document 1 by ThisEntry * 4
                play document 1
                else
                step backward document 1 by ToTal * 4
                step forward document 1 by ThisEntry * 4
            end if
        end tell
        
    end GoTo

I have also tried

time's takeStringValueFrom

any suggestions?

Thanks

B

Hi,

the array controller has a method selectionIndex() to get the selected row (0-based).
With the index you can retrieve the selected object from the array controller.


set selectionIndex to arrayController's selectionIndex()
if selectionIndex is not -1 then -- skip if nothing is selected
	set selectedObject to arrayController's arrangedObjects's objectAtIndex:selectionIndex
	set theTime to selectedObject's objectForKey:"time"
	-- .
end if

Im getting this error

2014-03-13 18:19:54.455 SMPTE Grabber[12750:303] *** -[AppDelegate GoTo:]: «class ocid» id «data optr000000002099220000600000» doesn't understand the "«event sysodlog»" message. (error -1708)

What am I doing wrong?

theTime is a Objective-C string object. To use it in AppleScript you have to coerce it to an AppleScript string


 set theTime to (selectedObject's objectForKey:"time") as text

Thanks Stefan

Its hard going between the AS and OBJ-C

Out of interest is there a way to return the same by double clicking on an entry?

Ben

NSTableView has a setDoubleAction: method. It takes a selector (handler) as argument