Jump to content

MouseMove - really slow :-(


ritzdank
 Share

Recommended Posts

i´m using autoitX under pyhton

reading serial data from COM port and triggerin mousemovements

from uspp import *
import msvcrt
import win32com.client
import time

autoit = win32com.client.Dispatch("AutoItX3.Control")
tty=SerialPort("COM1",1000,19200)

width = autoit.WinGetClientSizeWidth("Program Manager")
height = autoit.WinGetClientSizeHeight("Program Manager")

posx = width / 2
posy = height / 2

autoit.MouseMove(posx, posy)
time.sleep(1)

while 1:
    #dataX = ord(tty.read())
    dataY = ord(tty.read())
    dataZ = ord(tty.read())

    if dataY < 86:
        posx = posx - 3
        autoit.MouseMove(posx , posy, 50)

    if dataY > 172:
        posx = posx + 3
        autoit.MouseMove(posx , posy, 50)

    if dataZ < 86:
        posy = posy - 3
        autoit.MouseMove(posx , posy, 50)
    
    if dataZ > 172:
        posy = posy + 3
        autoit.MouseMove(posx , posy, 50)
        
    #print "X: ", dataX
    #print "Y: ", dataY
    #print "Z: ", dataZ
    #time.delay(0.06)
    tty.flush()

as you can see autoit.MouseMove(posx , posy, 50) speed is set to 0.05s, but when

i start the script the mouse move is really SLOW! does anyone have a clue?! should i

write time.sleep between autoit.MousMove commands ?!?!

thanks

Link to comment
Share on other sites

Speed

[optional] the speed to move the mouse in the range 1 (fastest) to 100 (slowest). A speed of 0 will move the mouse instantly. Default speed is 10.

Nothing mentioned about a time scale used. 10 is normal for a mouse to move, so your setting is slooowwww. Unless you want slow movement, I would not suggest setting it over 10 unless for good reason. If you want super speed, set it to 1 or 0.

:P

Edited by MHz
Link to comment
Share on other sites

If you want super speed, set it to 1 or 0. :nuke:

:P i forgot to mention that i tried it also with speed = 1 and 0 ... but unsatisfying. the mouse will take 4sec. to

go from center screen to maxleft side.

if dataY < 86:
        posx = posx - 1
        autoit.MouseMove(posx , posy, 0)
        time.sleep(0.005)
Edited by ritzdank
Link to comment
Share on other sites

Here is a VBScript sample that uses the AutoItX.dll. With the speed set at 1, I cannot see it move because it moves so fast. That is from one side of the desktop to the other. So I am unsure of your issue.

Set oAutoIt = CreateObject("AutoItX3.Control")
oAutoIt.MouseMove 1600, 600, 1
oAutoIt.MouseMove 0, 600, 1
Link to comment
Share on other sites

yep, the bug is that the incoming data from COM-port reduces

the speed of the endless-loop (while 1:).

tried this:

while 1:
    autoit.MouseMove(posx , posy, 10)
    autoit.MouseMove(posx - 400, posy - 400, 10)

and its as fast as a tesla-turbined-lotus car :P

Link to comment
Share on other sites

Who's idea what is to make something like 0-100? It would make more sense to be milliseconds.

Percentage of speed is easier and more sensible, IMHO. Who wants to calculate milliseconds per whatever distance (pixels, millimeters etc). No system could regulate a constant speed as per distance anyways and can fluctuate depending on CPU loads and hardware capabilities.

@ritzdank

I'm not sure if priority of CPU given to any event is a bug. You may need to find a workaround to move the mouse when CPU cycles are more available

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...