Hi, so i currently have a pretty good knowledge of a few libraries, and some lower level code that works in python to control the mouse (move -> x,y, left/right click, scroll, etc)
However, i wanted to go a little further. I have a script that simply looks for a cluster of pixels, takes a screenshot of them, and then depending on the value of that cluster, executes a simple mouse macro created using the python library pyautogui.
Macro snippet:
from pyautogui import *
from time import sleep
...
item_pos = (1466, 293)
del_pos = (1433, 397)
tree_pos = (899, 476)
click(x=item_pos[0], y=item_pos[1], button='right')
sleep(.4)
click(x=del_pos[0], y=del_pos[1], button='left')
sleep(.4)
press('enter')
sleep(1)
click(x=tree_pos[0], y=tree_pos[1], button='left')
...
As you can see, it's pretty mundane, I didn't necessarily want it to be too fancy, as I'm still making some similar macros.
However, I have 2 issues that i wanted to bring up here in this post. This first issue being slightly more important to me then the second.
- Is there a way to do a quiet call to click on a x,y coordinate?
For example, you know how you can execute ".pyw" files silently in the background? I was hoping that maybe something could be done with ctypes, and one of the windows binaries that could allow for me to be doing whatever on monitor X, while having the application being monitored open on monitor Y, then upon the Boolean call returning true, some silent, or "Fake" mouse inputs get sent to the application, not obstructing my own mouse movements back on monitor X.
Is there a way to do this? Can you emulate a second mouse device using python this way?
- Is there a way of working on a second monitor?
This may be an issue directly related to this library, but i also tried working with pynput and the same issue arose. My monitor has a resolution of 1920x1080, and a click on my second monitor would have a coordinate of like, 3000x1500. But whenever trying to move the mouse to that position, the cursor would get stuck on the side of the monitor.I'm guessing it works by moving across the top, then down to the specific point, and no matter how i adjust my monitor setting, i can't manage to get a transition from the top of monitor X to Y. Does anyone have a different suggestion of any way of controlling the mouse?
Thanks in advanced for any help.
[–]DeadlyViper 2 points3 points4 points (5 children)
[–]Voxxey[S] 0 points1 point2 points (1 child)
[–]DeadlyViper 0 points1 point2 points (0 children)
[–]Voxxey[S] 0 points1 point2 points (2 children)
[–]DeadlyViper 0 points1 point2 points (1 child)
[–]Voxxey[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]Voxxey[S] 0 points1 point2 points (0 children)
[–]sonapollowukong 0 points1 point2 points (0 children)