Scan to Folder (ScanSnap) - GUI scripting

Hi

Just purchased and installed ScanSnap IX500. Works like a champ. But I was hoping to automate the Scan to Folder accessory app to (i) expand the window to full size, (2) insert current date into text field for the filename and (3) then hand over to the user to complete.

The below script works for (1) and (2) no problem. I have a Quicksilver trigger which launches the script whenever the app Scan to Folder launches. But I cannot get applescript to put the cursor to the end of the current date in the text field. My various attempts are contained in the grayed out part of the script [between the two sets of (* and *)]. None of them does the trick. I am hoping someone might have a flash of inspiration fo this last part. Basically, I am seeking to have the cursor focussed in the right place so the user can keyboard in the desired file description, without having to drag the mouse around to click (in fact you need to double click) in the text field as a precursor to any keyboard entry.

Any suggestions gratefully received.

Cheers

delay 2

tell application "System Events"
	if exists process "Scan to Folder" then
		tell application "Scan to Folder" to activate
		tell process "Scan to Folder"
			try
				tell window "Scan to Folder"
					set position to [0, 0]
					set size to [1920, 1126]
					set value of text field 2 of row 1 of table 1 of scroll area 1 of group 1 to datetext
					--delay 1
					--select text field 2 of row 1 of table 1 of scroll area 1 of group 1

					(*
					try
						tell text field 2 of row 1 of table 1 of scroll area 1 of group 1
							set {xPosition, yPosition} to position
							set {xSize, ySize} to size
						end tell
						-- modify offsets if hot spot is not centered:
						click at {xPosition + (xSize div 2), yPosition + (ySize div 2)}
					end try
					
					--set AXFocused of text field 2 of row 1 of table 1 of scroll area 1 of group 1 to true
					--set AXSelectedText of text field 2 of row 1 of table 1 of scroll area 1 of group 1 to true
					*)
					
				end tell
			end try
		end tell
	end if

	(*
	delay 2
	keystroke tab
	delay 1
	keystroke tab
	delay 1
	keystroke tab
	delay 1
	keystroke (ASCII character 29) -- right arrow key
	*)

end tell

g’day

maybe this will do what your after, it will move the insertion point to the end and add a space
so you can start typing.

tell process "Scan to Folder"
keystroke (ASCII character 31) using command down -- moves cursor to end of text
keystroke space -- adds a space
end tell

not tested

Thanks for this.

With the keystroke method, I get patchy results. Depends on speed I suppose. Adjusting delay parameters helps but of course slows everything down. I have tp tab five times to get to the text field, then keystroke right arrow.

If there was a way to directly address the text field, and place cursor at end, would be best. I can set the contents, no probs. But selecting or otherwise addressing the text field has not been possible (as my grayed out efforts testify)

Cheers

Andrew