-
Changing Active Window
Greetings,
I am using a Robot object to simulate typing commands into a console. However, the console window might not always be the active window, so I am wondering if there is a way to change which window is active.
Using mouse movement and clicking will not help because this application will be done on many systems, with different resolutions, icon placements, etc.
One option I have is to simply use Java to open the application, making sure it is active, but this program has a GUI and a console. When it is opened, the GUI is active, and not the console, so keystrokes won't do anything there.
Any ideas? Thanks in advance.
-
This sounds like a problem that deals with operations close to the OS, something Java is weak on. If Windows, one solution is to use the JNI library to link with a C or C++ program that makes calls to user32 functions.
I don't know of any pure Java way to do this, but I'd love to learn if anyone knows of any.