Recording and saving from Java

I am trying to write a script to open a Web class that is a java app at a given time each week. Then to record and save the presentation, through the menu commands on the software. And then stop the recording at the end of the designated time. I have been able to launch the application navigate through the File menu to get the record dialog box up. Where I am stuck is how to get the name and file path into the dialog box and click the ok. I also am able to get it to stop recording and quit the application.

Here is what I have so far for getting the recording set up.

tell application “java”
activate
end tell

tell application “System Events”
tell process “java”
tell menu bar 1
tell menu bar item “File”
tell menu “File”
click menu item “Record Presentation”
end tell
end tell
end tell
end tell
end tell

set myName to “ThClass”
set theDate to current date

tell application “System Events”
tell process “java”
tell front window
write myName
return
end tell
end tell
end tell

I can get as far as opening the dialog box to save the recording. Any help would be greatly appreciated.

Xochi

There are lots of UI scripting examples available here if you use the search function.

Also, you’ll want UI Element inspector so you can find out how to address the interface element you want to script.

http://www.apple.com/applescript/uiscripting/02.html has the information you need.

If the Java App has normal shortcut commands I’d recommend using GUI scripting rather than UI scripting. See the examples below and I think you’ll see why…

To open a new finder window with UI scripting:

tell application "Finder" to activate
tell application "System Events"
	tell process "Finder"
		tell menu bar 1
			tell menu bar item "File"
				tell menu "File"
					click menu item "New Finder Window"
				end tell
			end tell
		end tell
	end tell
end tell

To open a new finder window with GUI scripting:

Tell app "Finder" to activate
Tell app "System Events" to keystroke "n" using command down

That’s a good point. You can sometimes get to the file name entry area by postkey’ing tab key-presses.