ritzdank Posted August 22, 2006 Posted August 22, 2006 i´m using autoitX under pyhton reading serial data from COM port and triggerin mousemovements expandcollapse popupfrom 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
MHz Posted August 22, 2006 Posted August 22, 2006 (edited) 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. Edited August 22, 2006 by MHz
ritzdank Posted August 22, 2006 Author Posted August 22, 2006 (edited) If you want super speed, set it to 1 or 0. 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 August 22, 2006 by ritzdank
MHz Posted August 22, 2006 Posted August 22, 2006 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
Richard Robertson Posted August 22, 2006 Posted August 22, 2006 Who's idea what is to make something like 0-100? It would make more sense to be milliseconds.
ritzdank Posted August 22, 2006 Author Posted August 22, 2006 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
MHz Posted August 22, 2006 Posted August 22, 2006 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.@ritzdankI'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
Richard Robertson Posted August 23, 2006 Posted August 23, 2006 I don't have any idea what percentage of speed is. Then lets all blame the endless loop problems, AutoIt is OK from what it looks like.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now