Jump to content

HotKeySet DoubleClick Detect


JohnBailey
 Share

Recommended Posts

... I like the double hotkey pressed thingy. I added it o my collection of snippets for future projects..

... Yeah, ssubirias3 did a nice job.

Wow, how crazy is that?? A noob to this stuff, putting together something others actually like and find useful?? Get out! Seriously, you guys are too kind and I appreciate the votes of confidence. If nothing else it shows how great of a job Jon and the team did putting together a program that anyone can use. If I can do this then anyone can!

Yikes! Almost sounds like an informercial line, doesn't it??? :)

Link to comment
Share on other sites

Wow, how crazy is that?? A noob to this stuff, putting together something others actually like and find useful?? Get out! Seriously, you guys are too kind and I appreciate the votes of confidence. If nothing else it shows how great of a job Jon and the team did putting together a program that anyone can use. If I can do this then anyone can!

Yikes! Almost sounds like an informercial line, doesn't it??? :)

hahahaha!

Edited by JohnBailey
A decision is a powerful thing
Link to comment
Share on other sites

True, If I can do this then surely anyone can... LOL And if you call now, I'll throw in the "dicer" at no extra cost.. LOL That's a $19.95 value absolutely FREE.. Hahaha It is great to find this coding language that I can use to do so many things. I also love this forum for feeding my newly found habit..

Link to comment
Share on other sites

  • 1 year later...

i dont know if its still revevant but i needed to detect double tap and came up with a code i like better the utelizing isPressed so take a look to see if it helps u...

this is part of a small bot i made for a game, what it does :

* pressing double "s" will keep s pressed down (release every 500ms and press again to make sure its pressed)

* pressing double "{SPACE}" will keep space pressed down (release every 500ms and press again to make sure its pressed, also makes bit delay b4 pressing again)

to stop the adlibs u just single press that key again, so to stop the space adlib single press space

hopes this helps all u guys.

P.S. it also responds to kepping a key pressed for as long as the allowed interval between 2 key strokes.

#include <Misc.au3>
HotKeySet("s","doubletap")
HotKeySet("{SPACE}","doubletap")
Global $goingSlow = False
Global $goingFast = False
Global $key, $keyFULL
Global $delay
Global $dll = DllOpen("user32.dll")
Global $timesKeyPressed = 0, $timerKey = 0, $lastKey = ""
While True
WEnd

Func s_Start(); slow down
    AdlibEnable("stop")
    $goingSlow = True
    If $goingSlow Then
        $delay = 0
        AdlibEnable("timed",500)
    EndIf
EndFunc

Func s_Stop()
    AdlibEnable("stop")
    $goingSlow = False
EndFunc

Func SPACE_Start(); speed up     
    AdlibEnable("stop")
    $goingFast = True
    If $goingFast Then
        $delay = 35
        AdlibEnable("timed",500)
    EndIf
EndFunc

Func SPACE_Stop()
    AdlibEnable("stop")
    $goingFast = False
EndFunc

Func timed()
    HotKeySet($keyFULL)
    Send("{" & $key & " up}")
    Sleep($delay)
    Send("{" & $key & "   down}")
    HotKeySet($keyFULL,"doubletap")
EndFunc

Func stop()
    AdlibDisable()
    Sleep(500)
    Send("{" & $key & " up}")
EndFunc

Func doubletap()
    $keyFULL = @HotKeyPressed
    HotKeySet($keyFULL)
    $key = StringRegExpReplace($keyFULL, "^\{(.*)\}$", "\1")
    If $keyFULL == $lastKey And TimerDiff($timerKey) < 300 Then
        Call($key & "_Start")
    Else
        Call($key & "_Stop")
    EndIf
    $lastKey = $keyFULL
    $timerKey = TimerInit()
    Send($lastKey)
    HotKeySet($lastKey,"doubletap")
EndFunc

Func OnAutoItExit()
    DllClose($dll)
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...