Controling a Javaw Window
Keywords: java javaw control manager extender sendkey
Question:
I am attempting to control a Java application using Control Manager Extender. I am able to successfull click a button in the Java
application using Roboscripter. However, when I attempt to run the code generated by Roboscripter I get a Window Not Found error.
Answer:
Java application might be difficult to automate using the Control Manager Extender. The Control Manager Extender
expects to work with standard windows controls.
However, If you were able to get it to work from Roboscripter we should be able to get the script to work.
First, Make sure you are giving the window enough time to be visible. WinWaitExist is useful.
My guess is that the Window Specification is changing each time the Java application is run. The easiest way to confirm this is to recor two seperate
scripts using Roboscripter, then compare the cWndbyWndSpec lines.
If the cWndbyWndSpec lines are the same you are in good shape. Add DebugTrace to the beginningof the script. make sure none of the retrun values from the cwndby
functions are 0. IF they are, then you will need to figure out why.
If the cWndbyWndSpec lines are the different then we know the Java application is modifiying the window specification each time. This
means we need to use DllHwnd instead. Dllhwnd expects a window title.
Question:
You were correct, the Java application is modifiying the window specification each time. However, I
am not able to determine the windowname. Roboscripter states window title not found.
Answer:
In that case when need to figure out the window name or id. One trick that seems to work is using WinItemNameID. It returns a list
of all open windows and their Window ID's. The first windowname in the list is generally the last activated window. Try extracting that name
from the list and pass it to DllHwnd ( you can also hard code it once you figure out the name) . The code might look something like this:
winlist = WinItemNameID()
title = ItemExtract( 1, winlist, '|' )
parenthandle = DllHwnd( title )
Article ID: W16819
File Created: 2007:07:03:14:26:24
Last Updated: 2007:07:03:14:26:24