Jump to content
Sign in to follow this  
Moughor

Clone mouse

Recommended Posts

Moughor

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 by Moughor

Share this post


Link to post
Share on other sites
Rawox

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 by Rawox

Share this post


Link to post
Share on other sites
Moughor

thx a lot :idea:

Is control click more faster ?

Moughor

Share this post


Link to post
Share on other sites
Rawox

I'm not sure but I think their are equal and ControlClick can be used if you know the 'control'

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.