Scripting fields within a dialog window

Here’s my problem. I am using Indesign, along with a plugin that is NOT scriptable (HP’s SmartStream). In menu 11, there is the first item, called “Database…”. this script below works perfectly to click on that menu item and bring it up. Now, the dialog box that pops up, requires that I go out and locate a database file, using a SELECT button. I would like to be able fill that field and click OK in the dialog box. Is there anyway to do that at all? Preferrably using applescript, but I would be open to other solutions as well.

tell application "Adobe InDesign CS6"
	make new document
	tell application "System Events" to tell process "InDesign"
		tell menu bar 1
			tell menu 11
				click menu item "Database..."
				--display dialog MyItem
			end tell
		end tell
	end tell
end tell



I don’t own inDesign but I assume that the code which I use in a Preview print dialog may be reused as a skeleton here.

on imprimePage(theApp, wName, firstPage, lastPage)
	activate application theApp
	tell application "System Events" to tell application process theApp
		keystroke "p" using {command down}
		tell window wName
			repeat until exists sheet 1
				delay 0.1
			end repeat
			if (count every radio group of sheet 1) = 0 then
				click button -1 of sheet 1 -- switch to expanded dialog
				repeat until (count every radio group of sheet 1) > 0
					-- wait that the sheet expands
				end repeat
			end if
			tell sheet 1
				click radio button 2 of last radio group
				set value of text field 1 to firstPage
				set value of text field 2 to lastPage
			end tell -- sheet
		end tell -- window
		# error number -128
		keystroke return
	end tell -- System Events.
end imprimePage

Yvan KOENIG (VALLAURIS, France) mercredi 16 janvier 2013 10:43:37