Sign in to follow this  
Followers 0
Merchants

Hotkey func problem

3 posts in this topic

#1 ·  Posted (edited)

this is wat i want

i press 1x p then do noting

if i press 2x p in 90 millisecondes then run func... else do noting

HotKeySet("p", "Toggle1")

Func Toggle1()
    Send("Job done!")
Endfunc
Edited by Merchants

Share this post


Link to post
Share on other sites



maybe use Timerint() to check for time

Share this post


Link to post
Share on other sites

I'm not going to lie, there probably is a lot cleaner way of doing this, but this works:

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1

    While Not _IsPressed(50,$dll)
                Sleep(1)
        If _IsPressed(50,$dll) Then

            While _IsPressed(50,$dll)
                Sleep(1)
            WEnd
            $Timer=TimerInit()
            While TimerDiff($Timer)<=90
                If _IsPressed(50,$dll) Then _PPressed()
            WEnd
            ExitLoop
        EndIf
    WEnd

WEnd

Func _PPressed()

Msgbox(0,"Information","P was pressed twice in "&Round(TimerDiff($Timer),3)&" milliseconds!")

EndFunc

Instant Lockerz Invite - www.instantlockerzinvite.co.uk

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  
Followers 0