Rraney Posted October 13, 2005 Share Posted October 13, 2005 (edited) Is it possible to recieve signals from AutoItX when it has finnished a command like MouseMove, MouseUp, or other command to move or toggle the mouse? the example shows my problem. While python is running, it tosses the MouseMove commands to AutoItX and continues on. Never knowing when the command has finnished. What Im currently running into this problem in python scripts, see example script. expandcollapse popupimport win32com.client o = win32com.client.Dispatch( "AutoItX3.Control" ) # ----------- Configure defaults for AutoItX ----------------- o.AutoItSetOption("PixelCoordMode",1) #make sure we are in absolute screen Coord mode #======================== # MOUSE stuff #======================== # MoveMouse to location on screen # a check for negitives should be built to return an error # ----------------------------------------------------------------------------- def MouseMove(x,y, speed = 10): print("Moving mouse to : " + str(x) + "," +str(y)) o.MouseMove(x, y, speed) # MouseBox move mouse in box # ----------------------------------------------------------------------------- def MouseBox(top_x, top_y, bottom_x, bottom_y, speed = 10): # a bit of debugging print ("Boxing mouse") MouseMove(top_x, top_y, speed) MouseMove(bottom_x, top_y, speed) MouseMove(bottom_x, bottom_y, speed) MouseMove(top_x, bottom_y, speed) MouseMove(top_x, top_y, speed) return # Move the mouse in boxes. for t in range(10, 300, 50) : MouseBox(t, t, t, t, 100)[/font] Edited October 13, 2005 by Rraney Link to comment Share on other sites More sharing options...
zfisherdrums Posted October 21, 2005 Share Posted October 21, 2005 Rraney, Admittedly, I am not schooled in the vernacular of Python so I apologize if this post is not helpful. When I ran the MouseMove command in VBA, I tested for any return value. Without fail, it returned a value of "1". That said, would it be possible to test for the value of "1" within your code like: If (o.MouseMove(x, y, speed)) = 1 then ...continue code here I've had problems with synchronicity using the AutoIt object in some of my programs as well. But these were due to limitations in the language, not because of AutoIt... and certainly not pilot error... I think??? Let me know if this works/helps or not! Identify .NET controls by their design time namesLazyReader© could have read all this for you. Unit Testing for AutoItFolder WatcherWord Doc ComparisonThis here blog... Link to comment Share on other sites More sharing options...
Rraney Posted October 21, 2005 Author Share Posted October 21, 2005 The problem as I see it, is that AutoItX returns a 1(True) when it receives the command to move the mouse, not after it has completed moving the mouse. So in the example script i listed in post , script attempts to move the mouse in ever growing boxes, but as it runs, it just moves the mouse diagonally across the screen.Admittedly I wouldn't have problems with this if I could somehow work out a timing system to let me know just how long it will take AutoItX to move the mouse from a point A to point B. But currently I can not figure out how to do it with out calling AutoItX to get the current Cursor location.- RraneyRraney,Admittedly, I am not schooled in the vernacular of Python so I apologize if this post is not helpful.When I ran the MouseMove command in VBA, I tested for any return value. Without fail, it returned a value of "1". That said, would it be possible to test for the value of "1" within your code like:If (o.MouseMove(x, y, speed)) = 1 then ...continue code hereI've had problems with synchronicity using the AutoIt object in some of my programs as well. But these were due to limitations in the language, not because of AutoIt... and certainly not pilot error... I think???Let me know if this works/helps or not! Link to comment Share on other sites More sharing options...
Rraney Posted October 21, 2005 Author Share Posted October 21, 2005 Ignor me, I took the word of a coworker who and I just passed the error on to the board here with out reviewing it for errors. I found a slight error with it. All it does is draw a line. Duh.. Bad person I be' # Move the mouse in boxes.for t in range(10, 300, 50) : MouseBox(t, t, t, t, 100)should be: # Move the mouse in boxes.for t in range(10, 300, 50) : MouseBox(1, 1, t, t, 100)Works now. Sorry about the spam. Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 22, 2005 Share Posted October 22, 2005 Don't worry, it wasn't spam. Spam is pointless, you had an actual question. Link to comment Share on other sites More sharing options...
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