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?

解决方案

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

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐