0

I would like to know if it is possible to recognise something that's on the screen, and let my program click it in java. What i have done so far is just get the coordinates of the object I want to click and use the robot class to click it. But I suppose my program won't work on computers with a different resolution for example (or if the object is in a different place).

Here is an example of what I would like to achieve:

I have my browser open and I want my program to scan the screen for the minimize button. Then i would like to move the cursor to the minimize button. And finally I would like the program to simulate a mouseclick.

I do know how to move the mouse and simulate a mouseclick using the Robot class, so the only problem that remains is that I don't know how I can scan the screen for something and (if necessary) get the coordinates of it?

Joey
  • 154
  • 5
  • 18
  • 1
    Would just minimizing the window directly (without finding the minimize button) If so see this http://stackoverflow.com/questions/6662956/handle-external-windows-using-java – Matthew Cassar Dec 07 '15 at 15:26
  • I appreciate your comment, but the minimizing thing was just an example. I realy want to learn how to recognise things on the screen and move the mouse to that location – Joey Dec 07 '15 at 15:28
  • Dont know if your only way is to get a screenshot and make your way to get what you want from the pixels... maybe some kind of pixel-pattern? – Nanoc Dec 07 '15 at 15:34
  • I was thinking the same, but still I don't know how to get that into code and strangely I can' find anything about it on google. – Joey Dec 07 '15 at 15:38

0 Answers0