UI scripting of table: problem with rows and cells

Hello
I am working on a script for Bookpedia to add books from a list of ebook files. I can’t seem to get the script to edit a table field and then release its focus. Here’s where I get stuck:

click radio button "Links"
								repeat with aFile in files_
									click button 1
									keystroke item 2 of aFile
									tell scroll area 1
										tell table 1
											tell table row 1
												tell text field 1
													set focused to false
												end tell
											end tell
										end tell
									end tell
set value of text field 1 to item 1 of aFile
								end repeat

I can post the whole script but its a little long. Basically, when you click add in bookpedia’s links panel, it auto focuses on the first field of a new table row. That’s great. I can immediatly use a keystroke command to enter a new value. But how do I release?? I need to move on (with the row selected) and edit a neighboring text field. It batch processes files, hence the repeat. The list “aFile” is like {location, kind}, strings which describe the file.

So, oh scripting gods, how do I change the focus and stop editing the cell??

Model: Macbook (black)
AppleScript: 1.10.7
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Thanks Jacques
My real problem is needing to stop editing the row so that it is merely selected. I’ve used UI browser and from what it says, I need to be able to disable the field’s focus atribute. Apple’s element inspector tells me the same thing. In order to edit the second text field (not in the table) the row has to be selected but not focused. When I try:

click button 1
	tell scroll area 1
		tell table 1
			tell table row 1
				tell text field 1
					keystroke "my document"
					set focused to false
			set selected to true
			end tell
		end tell
	end tell
end tell
set value of text field 1 to "my link"

I get an error about not being able to make text field 1 of (…) into type reference. I’m don’t know how else I could tell it to unfocus…

Great Jacques!! It’s working fine now!

I’m smiling again :smiley: