Moughor Posted May 6, 2010 Posted May 6, 2010 (edited) Hi all, i'm trying to clone mouse click on 2 windows of different size. it works but it's quiet slow any idea how to have it faster ? write in the dll maybe ? Thanks Moughor ps : or is there a way to send as a "key" the click mouse without move it ? #include <Misc.au3> $dll = DllOpen("user32.dll") $win1 = WinGetHandle ("[TITLE:win; INSTANCE:1]", "") $win2 = WinGetHandle ("[TITLE:win; INSTANCE:2]", "") $winP2 = WinGetPos( $win1 ) $winP1 = WinGetPos ( $win2 ) MsgBox(0, "Active window stats (x,y,width,height):", $winP1[0] & " " & $winP1[1] & " " & $winP1[2] & " " & $winP1[3]) MsgBox(0, "Active window stats (x,y,width,height):", $winP2[0] & " " & $winP2[1] & " " & $winP2[2] & " " & $winP2[3]) $ratioX = $winP2[2] / $winP1[2] $ratioY = $winP2[3] / $winP1[3] While 1 Sleep ( 1 ) If _IsPressed("04", $dll) Then $posMouse = MouseGetPos() sleep(200) MouseClick("middle",(($posMouse[0]/$ratioX)+$winP1[0]) ,(($posMouse[1]/$ratioY)+$winP1[1]) ) MouseMove($posMouse[0],$posMouse[1]) EndIf WEnd DllClose("user32.dll") Edited May 6, 2010 by Moughor
Rawox Posted May 6, 2010 Posted May 6, 2010 (edited) MouseClick ( "button" [, x, y [, clicks [, speed ]]] ) Use something like: MouseClick("middle",(($posMouse[0]/$ratioX)+$winP1[0]) ,(($posMouse[1]/$ratioY)+$winP1[1]), 1, 1 ) MouseMove($posMouse[0],$posMouse[1], 1) Rawox Edited May 6, 2010 by Rawox
Moughor Posted May 6, 2010 Author Posted May 6, 2010 thx a lot Is control click more faster ? Moughor
Rawox Posted May 6, 2010 Posted May 6, 2010 I'm not sure but I think their are equal and ControlClick can be used if you know the 'control'
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