Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Fast Mouse Control


  • Please log in to reply
10 replies to this topic
wolf_II
  • Members
  • 343 posts
  • Last active: Jul 23 2010 05:19 PM
  • Joined: 18 Oct 2007
;---------------------------------------------------------------------------
SendMouse_LeftClick() { ; send fast left mouse clicks
;---------------------------------------------------------------------------
    DllCall("mouse_event", "UInt", 0x02) ; left button down
    DllCall("mouse_event", "UInt", 0x04) ; left button up
}


;---------------------------------------------------------------------------
SendMouse_RightClick() { ; send fast right mouse clicks
;---------------------------------------------------------------------------
    DllCall("mouse_event", "UInt", 0x08) ; right button down
    DllCall("mouse_event", "UInt", 0x10) ; right button up
}


;---------------------------------------------------------------------------
SendMouse_MiddleClick() { ; send fast middle mouse clicks
;---------------------------------------------------------------------------
    DllCall("mouse_event", "UInt", 0x20) ; middle button down
    DllCall("mouse_event", "UInt", 0x40) ; middle button up
}


;---------------------------------------------------------------------------
SendMouse_RelativeMove(x, y) { ; send fast relative mouse moves
;---------------------------------------------------------------------------
    DllCall("mouse_event", "UInt", 0x01, "UInt", x, "UInt", y) ; move
}


;---------------------------------------------------------------------------
SendMouse_AbsoluteMove(x, y) { ; send fast absolute mouse moves
;---------------------------------------------------------------------------
    ; Absolute coords go from 0..65535 so we have to change to pixel coords
    ;-----------------------------------------------------------------------
    static SysX, SysY
    If (SysX = "")
        SysX := 65535//A_ScreenWidth, SysY := 65535//A_ScreenHeight
    DllCall("mouse_event", "UInt", 0x8001, "UInt", x*SysX, "UInt", y*SysY)
}


;---------------------------------------------------------------------------
SendMouse_Wheel(w) { ; send mouse wheel movement, pos=forwards neg=backwards
;---------------------------------------------------------------------------
    DllCall("mouse_event", "UInt", 0x800, "UInt", 0, "UInt", 0, "UInt", w)
}
Tested with:
#Include SendMouse.ahk
CoordMode, Mouse, Screen

F12::

    SendMouse_RelativeMove(50,50)
    MouseGetPos, mx, my
    ToolTip, %mx% %my%
    Sleep, 2000

    SendMouse_AbsoluteMove(800,500)
    MouseGetPos, mx, my
    ToolTip, %mx% %my%
    Sleep, 2000

    SendMouse_Wheel(4000)
    Sleep, 2000
    SendMouse_Wheel(-4000)
    Sleep, 2000

Return

Also tested in this thread: <!-- m -->http://www.autohotke...pic.php?t=58286<!-- m -->
Wolf

Schön wär's, wenn's schön wär!

  • Guests
  • Last active:
  • Joined: --
:D pretty fast, but what do you use it for?

wolf_II
  • Members
  • 343 posts
  • Last active: Jul 23 2010 05:19 PM
  • Joined: 18 Oct 2007
At first it was an attempt to find a fast way asked for in the linked thread. But I plan to use it in situations where SetMouseDelay, 0 will lead to unexpected behaviour (one instance detected already).

At this time there is nothing to support my hope it will help.
Wolf

Schön wär's, wenn's schön wär!

Lomi
  • Guests
  • Last active:
  • Joined: --
Is there a way to send a mouse wheel tilt left or right?

Do you know how to detect Logitech mouse mouse wheel tilts in XP?

TheGood
  • Members
  • 589 posts
  • Last active: Mar 22 2014 03:22 PM
  • Joined: 30 Jul 2007

Do you know how to detect Logitech mouse mouse wheel tilts in XP?

You'll need to install SetPoint. Windows XP cannot natively detect mouse wheel tilts.

Me
  • Guests
  • Last active:
  • Joined: --
This speeds up the mouse? ... does it make it so when drawing a line in certain apps, there will no longer be dots drawn instead of a line if you move the mouse quickly? ....

If not then what is it?

tomoe_uehara
  • Members
  • 2166 posts
  • Last active: Jun 11 2015 05:33 PM
  • Joined: 05 Sep 2009
I've just used this function in a game, and it's very fast!
Loop{
Click
}
; Result = 470 clicks in 10 seconds

SendMouse_LeftClick()
; Result = 11840 clicks in 10 seconds
Thank you wolf_II 8)

SageOfDragonBane
  • Guests
  • Last active:
  • Joined: --
I'm getting far fewer clicks than 1000 in 10 seconds. I'm only getting around 520 in 10 seconds. Is this due to my processor, or am I missing something?

SageOfDragonBane
  • Guests
  • Last active:
  • Joined: --

I'm getting far fewer clicks than 1000 in 10 seconds. I'm only getting around 520 in 10 seconds. Is this due to my processor, or am I missing something?


Ignore this, I figured it out. I was using it to do something in firefox.. as soon as i switched to IE it worked. Thanks for this script!

  • Guests
  • Last active:
  • Joined: --

I've just used this function in a game, and it's very fast!

Loop{
Click
}
; Result = 470 clicks in 10 seconds

SendMouse_LeftClick()
; Result = 11840 clicks in 10 seconds
Thank you wolf_II 8)


how exactly is this script used and installed? i want to try it out on a game and I use chrome.

gacel112
  • Members
  • 10 posts
  • Last active: Jul 27 2015 04:36 PM
  • Joined: 20 Jul 2015

How to use it in an not focused window ?