Photoshop GUI Scripting

I am trying to automate the scanning process using Adobe Photoshop CS2. I have to launch PS, do the “Twain Acquire…” command (this has no key command and no AS command) from the File menu. I have accomplished this with menu scripting. Then i have to click the “Preview” button in the resulting window (also with no key command or menu command.) I have tried this:

tell application "Adobe Photoshop CS2"
	activate
end tell

try
	tell application "System Events"
		tell process "Adobe Photoshop CS2"
			click button "Preview" of window 1
		end tell
	end tell
on error
	return false
end try

but it hasnt worked. It has just frozen Script editor and not even activated PS. Any help would be greatly appreciated. Thanks.

Model: iMac G4 700 MHz
AppleScript: 1.10.6
Browser: Firefox 1.0.7
Operating System: Mac OS X (10.4)

I’m not sure what scanner or scanner software you use. At home twain aquire launches the Epson scanning software and at work we use a dedicated scanning software. If your set-up launches a different software package for the actual scanning then you would have to address that program to try to script the interface.