4

Anyways, I'm building a bot to run in the background. This bot requires me to click. Of course, I want to be able to do other things while the bot is running.

So I was wondering if it was possible for me to simulate a mouse click at a certain position on an inactive window.

If this is possible, I would greatly appreciate it if any of you could help me.

Josh Crozier
  • 233,099
  • 56
  • 391
  • 304
iAndr0idOs
  • 257
  • 4
  • 14

1 Answers1

1

java.awt.Robot

Clicking into an active window is going to activate it, though.

bestsss
  • 11,796
  • 3
  • 53
  • 63
  • Correct me if I'm wrong, but I don't think this class works for clicking on inactive windows – functionptr Jun 27 '11 at 20:04
  • why? it drives the mouse pointer by screen coordinates, and then 'clicks' (the coordinates are screen ones) – bestsss Jun 27 '11 at 20:14
  • The problem is, it has to be in the background. Is there any way I can have it simulate clicks while it's in the background? – iAndr0idOs Jun 27 '11 at 22:50
  • Well, so the frame is actually minimized (for instance), you don't have much of a chance, simulating alt+tab, taking a screenshot, processing to see if the title is there and ultimately running it. Alternatively, use more than a single monitor and keep the window in front all the time... starting a VM (not java) and running its own OS w/ a virtual screen can be an option too. What you want is running a robot but interfering meanwhile. – bestsss Jun 28 '11 at 05:50