Closed Stivijs97 closed 11 months ago
The click_duration
parameter has nothing to do with the duration of the movement, the time it takes from point A to B. It is just the time it holds down the left button of the mouse when clicking, it's not really your fault you got confused because the duration
parameter should have been there. (I will add it soon).
For the slow and jittery movement, it is from steady=True
, which tries to mimic human doing the movement in a straight line, which tends to be slower to do and unstable, jittery.
The only problem I see is, it is taking it 15 seconds to move 300 by 200 pixels, which with even those parameters (steady=True which should only longen it a bit), is very long and abnormal, I will check it out and hopefully fix it soon.
The
click_duration
parameter has nothing to do with the duration of the movement, the time it takes from point A to B. It is just the time it holds down the left button of the mouse when clicking, it's not really your fault you got confused because theduration
parameter should have been there. (I will add it soon).For the slow and jittery movement, it is from
steady=True
, which tries to mimic human doing the movement in a straight line, which tends to be slower to do and unstable, jittery.The only problem I see is, it is taking it 15 seconds to move 300 by 200 pixels, which with even those parameters (steady=True which should only longen it a bit), is very long and abnormal, I will check it out and hopefully fix it soon.
I was editing the lib itself with duration, as system cursor doesn't seem to have a duration variable you can set (unless I messed up big somewhere). I'll try again without steady but I'm pretty sure it was still very slow
Yeah, you can just momentarily do that if you dont want to wait me, just add parameter duration=None
on the click_on()
function, and add duration=duration
inside this line self.move_to(point, steady=steady)
. I will find what could be wrong with the steady option.
No matter how short the duration is set to, this is the result. If i set it to say 120, it does take a lot longer.
No matter how short the duration is set to, this is the result. If i set it to say 120, it does take a lot longer.
I have been testing almost every scenario, also your exact code, but can't seem to replicate this error you are encountering. Maybe it is something local on your pc, because I can't seem to find out what's wrong on my side. My last thought is the computing power, maybe try changing the target_points
of human_curve = HumanizeMouseTrajectory(...)
on the move_to
function of SystemCursor
class, to target_points=int(target_points / 2)
or even int(target_points / 3)
. This may help fasten and smoothen the movement if your computer is slow. I don't have any other idea i'm sorry, if you find the solution let me know.
second notice, looking at the speed of your print statements that appear on the terminal, it seems it is running way too slow on your computer. They should print instantly right after the other, indicating a smooth movement. Try also removing the duration you have set to 0.015, because even if it works fine, the way the package works right now, won't be able to do the movement that quick, it is way to unrealistic, you are better off just instantly moving the cursor to that location using just pyautogui, not making a movement at all.
Tried disabling my secondary monitor, lowering the resolution on my ultrawide, disabling logitech mouse software, nothing helped.
I tried another HMM lib, the mouse has no issue moving with that one (it however has issues with either 1ms mouse clicks or a minimum of 100ms, whilst realistic would be ~30-80)
Update Completely wiped python from my pc, reinstalled, and now it seems to be working fine. Very odd since before this I tried forcing upgrade on all dependencies and everything.
Edit2: Thank you for all your efforts to help though :)
Don't worry, hopefully you solved it.
Hey, had the same issue on macos. What fixed it for me was setting pyautogui.DARWIN_CATCH_UP_TIME = 0
. Not sure if this a good idea or not since the pyautogui documentation makes it sound like it's necessary:
There is also a pyautogui.DARWIN_CATCH_UP_TIME setting which adds an additional delay on macOS after keyboard and mouse events, since the operating system appears to need a delay after PyAutoGUI issues these events. It is set to 0.01 by default, adding an additional hundredth-second delay.
But it seems to be working for me, so going to run with this for now.
from humancursor import SystemCursor import random sleep_time = random.uniform(0.03, 0.1) cursor = SystemCursor() cursor.click_on([2800,540],click_duration=sleep_time,steady=True)
Very simple code, I tried adjusting the duration to close to 0, and the mouse jitters very slowly to destination, takes around 15 seconds to move 300 down and 200 right (roughly). Tried disabling any mouse related software - still same issue persists.
Any ideas?