0

How can I operate a software program with java? For example, I would like to operate VyprVPN to disconnect & reconnect switch servers etc.

I know you can position mouse and click with the robot class but I need something more specific like be able to identify the buttons and give them different id's or something along those lines.

Is this possible?

Pravinsingh Waghela
  • 2,516
  • 4
  • 32
  • 50
Joe Taylor
  • 171
  • 1
  • 1
  • 16

1 Answers1

1

It can be done with Reflection or Byte Code Engineering Library (BCEL), although I'm not sure how active is the development and support for the latter.

Both require great reverse engineering knowledge and will work only if the target program is written in Java too.

Otherwise there is really no better solution than to capture screen and use image processing to recognize certain elements, then determine what action should you take for if a given button, or a different element, is found.

Please keep in mind that this is not a simple programming task. There are programs which can help you to record or even provide with a simple programming interface do define your own macro, but that interface is usually very limiting. And also, those programs are not cheap.

In my opinion, if you really want to use Java, best solution would be to have a fixed window size and find corresponding coordinates for buttons or other UI controls, then use Robot API to click these actions. You could make it a bit more miss-click prone by finding position of window handle and normalize mouse coordinates based on window location.

Community
  • 1
  • 1
Marko Gresak
  • 7,950
  • 5
  • 40
  • 46