1

I've made a simple click bot to automatically play an android game on my Windows PC. It currently identifies when certain things change on the screen then moves the mouse and clicks the correct button.

Currently I am using the following win32api functions to achieve this:

Win32api.SetCursorPos(Position)
Win32api.mouse_event(winn32con.MOUSEEVENTF_LEFTDOWN,0,0)
Win32api.mouse_event(winn32con.MOUSEEVENTF_LEFTUP,0,0)

These work great however when I use the bot it takes over my computer's mouse and I basically have to let it run. Is there anyway I could simulate a click without it actually using my mouse, or is there a way I could isolate the bot on one of my other screens and be able to work freely on the other?

theB
  • 6,450
  • 1
  • 28
  • 38
J.Trotter
  • 11
  • 1
  • 4

1 Answers1

0

There is a lib specific for deal with user interaction components and periferics: pyautogui

Here, is a short and easy to try documentation for performing/simulating mouse click DOWN & UP

https://pyautogui.readthedocs.org/en/latest/mouse.html#the-mousedown-and-mouseup-functions

Andre Pastore
  • 2,841
  • 4
  • 33
  • 44
  • Thanks for that, however I don't have a problem with the mouse working. The problem is that while the script is running i cannot use the mouse for anything else. I'm looking for a way to simulate a click without just taking over the mouse. – J.Trotter Oct 24 '15 at 16:25
  • I believe that this lib can help you. Maybe, if there is something that blocks the usage, you can create a separated thread to run this mouseClick programatically. Given code is not for handle mouse clicks, but exactly to perform these events without mouse interaction. Makes sense for your case? – Andre Pastore Oct 24 '15 at 17:34