scripting an applescript unaware application?

i’m trying to script an application, mpeg streamclip, to batch process video files from
a camera to make them more editing friendly. mpeg streamclip, however, is not
applescript aware. i’ve gotten help elsewhere and have gotten to a certain point but
came here to try to get past an impasse.

i can open the app, open the batch window, open the load files window, and
navigate to the drive containing the video. once there, though, i don’t know how to
burrow down into a series of folders to get to the video.

here is the code so far:

tell application "MPEG Streamclip"
	activate
end tell

tell application "System Events"
	tell process "MPEG Streamclip"
		keystroke "b" using {command down}
		delay 1.5
		keystroke return
		delay 1.5
		tell window "MPEG Streamclip - Batch List"
			click button "Add Files."
		end tell
		tell window "Open Files"
			-- sidebar is in group 2
			tell group 2
				tell splitter group 1
					tell scroll area 1
						tell outline 1
							-- this may select the wrong item if there are two items with the same name
							set driveRow to item 1 of (every row whose (value of static text 1) is "DriveName")
							select driveRow
						end tell
					end tell
				end tell
			end tell
		end tell
		
		delay 1.5

tw, user on another forum, helped me get this far. i’m using uielementinspector to get
information about window elements. it does not display things like the group number
so i don’t know how tw came up with group 2 for the left pane of the ‘open files’ window.
i also don’t know, once i get into my drive, how to get to the folder, several layers deep,
that i’m looking for. for what it’s worth, the drive and folder structure is always the same.

my thinking now is that i could follow the above code with a repeat of the ‘tell window “Open Files”’
routine, switching to the main navigation pane containing the folders, and adding additional
groups, rows, etc, as necessary. i thought i could repeat this several times until i get down
to the folder i need. don’t really see how to do this, though, without knowing group and
other numbering info.

maybe there’s a better way?

just for info, i’m trying to make this script to help someone i work with who has a disability
that makes this kind of navigation and processing pretty much impossible. if i can get
through this, i can get him something he can just click on on the desktop and have the
script handle everything. that’s the aim, anyway. any further suggestions most appreciated.

thanks,
BabaG

It costs a few dollars but UI Browser will help you.

This is actually very easy once you know how. Here’s an example of how to open a file in MPEG Streamclip. Note that you do not have to burrow into folders. If you know the path to the file you can skip all that. Let’s pretend the file you want to open is in your documents folder and called “test.mp4”.

-- this is the file you want to choose from the open dialog box
set filePath to (path to documents folder as text) & "test.mp4"
set posixFilePath to POSIX path of filePath -- later we need to posix path of this file

tell application "MPEG Streamclip" to activate
delay 0.5

tell application "System Events"
	tell process "MPEG Streamclip"
		-- open the "open files..." dialog box
		keystroke "o" using command down
		delay 0.5
		
		-- open the "enter path" sheet where we can type in the path to a file
		keystroke "g" using {command down, shift down}
		delay 0.5
		
		-- enter the file path, note it must be posix style
		keystroke posixFilePath
		delay 0.5
		
		-- press the return keys
		keystroke return
		delay 0.5
		keystroke return
		
	end tell
end tell

thanks, regulus6633.

this is great. i need to do this from the batch window rather than the
main program window which makes it a little more complicated. i was
able to get the posix path window to open successfully by incorporating
your code into mine after the batch window’s ‘open files’ window is called.
was able to paste in the filepath and get to the folder. now i just need to
figure out how select all mts files to load them.

thanks again,
BabaG