Selecting file through UI Scripting

I’m trying to automate some stuff in DVD Studio Pro. Since DVD Studio Pro is not scriptable, I must employ UI scripting. I’m having trouble when I want to import an asset. After hitting the shorcut key to import your basic window comes up to choose the file to be imported( This window is the same as if you were opening a file in an pretty much all applications) . I can successfully choose a directory on the left to start from. However, in the box on the right, I need to go through some folders to get to the desired file. Does anyone know how to select these folders and eventually the file through UI scripting. Any help would be greatly appreciated. If something’s not understandable please let me know. What I want to accomplish should be the same in practially all applications. Thanks for any help.

Hi ,

This post is really old and I was wondering if anyone has an answer to this problem since I need to do the same thing for an application without scripting support.

Many thanks

EM

Hi,

this is an example which works for TextEdit. As the open save dialog boxes can be customized, the index of the UI elements could be different


set theFile to "Read me"
activate application "TextEdit"
tell application "System Events"
	tell process "TextEdit"
		keystroke "o" using command down
		tell window "Open"
			keystroke "g" using {command down, shift down}
			repeat until exists sheet 1
				delay 0.5
			end repeat
			tell sheet 1
				keystroke "/path/to/folder"
				click button "Go"
			end tell
			delay 0.5
			tell (1st row of outline 1 of scroll area 2 of splitter group 1 of group 2 whose value of static text 1 is theFile) to set value of attribute "AXSelected" to true
			click button "Open"
		end tell
	end tell
end tell