Hold down left click for a certain period before mouse event

Get help with using AutoHotkey and its commands and hotkeys
Bpd
Posts: 17
Joined: 25 Mar 2019, 09:59

Hold down left click for a certain period before mouse event

17 Nov 2019, 09:17

Hi All,

I'm just wondering how I would produce a script which;

1. Only activates after the left button has been held down for x amount of milliseconds.
2. If the left button is released before reaching x milliseconds, it resets.
3. after reaching x milliseconds it utilises a DllCall("mouse_event" to move the mouse.
3.1 If possible, can DllCall("mouse_event" be moved over an allocated period of time?
4. after the DllCall it resets back to the start.

I'm currently utilising the following which works, but continues to work while LButton is held down, and does not reset.
Also, as im utilising while, the DllCall loops which contributes to the issue above.

Code: Select all

*~$LButton::
    KeyWait LButton, T0.900
    while GetKeyState("LButton")
    {    
        DllCall("mouse_event", uint, 1, int, 0, int, 12, uint, 0, int, 0)
        Sleep, 10
    }
Return

Any insight would be appreciated!
Thank you.

Return to “Ask For Help”

Who is online

Users browsing this forum: DaveT1, detosorgetz, erikals and 85 guests