Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Misc.au3>
- Global $codes[128] = [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127]
- Global $names[128] = ['BS', 'HT', 'LF', 'VT', 'FF', 'CR', 'SO', 'SI', 'DLE', 'DC1', 'DC2', 'DC3', 'DC4', 'NAK', 'SYN', 'ETB', 'CAN', 'EM', 'SUB', 'ESC', 'FS', 'GS', 'RS', 'US', 'space', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12', '|', '}', '~', 'DEL']
- Global $pressedTime[128] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
- Global $releasedTime[128] = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000]
- Global $status[128] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
- $dll = DllOpen('user32.dll')
- $loopDelay = 10
- $doubleClickInterval = 300
- $continue = 1
- While $continue
- Sleep($loopDelay)
- If _IsPressed(Hex(9), $dll) Then
- $continue = 0
- EndIf
- For $i = 0 To UBound($pressedTime) - 1
- If _IsPressed(Hex($codes[$i]), $dll) Then
- $pressedTime[$i] += $loopDelay
- If $pressedTime[$i] > $doubleClickInterval Then
- $status[$i] = 0
- MsgBox(4096, "Title", "Long pressed: "&$names[$i]&"")
- ContinueLoop
- EndIf
- If $status[$i] == 2 Then
- If $releasedTime[$i] >= $doubleClickInterval Then
- $status[$i] = 5
- Else
- $status[$i] = 3
- EndIf
- ElseIf $status[$i] == 0 Then
- $status[$i] = 1
- EndIf
- $releasedTime[$i] = 0
- Else
- If $releasedTime[$i] < $doubleClickInterval Then
- $releasedTime[$i] += $loopDelay
- EndIf
- ;~ 0 blocked
- ;~ 1 ready
- ;~ 2 waiting
- ;~ 3 double press
- ;~ 4 long press
- ;~ 5 single press
- ;~ 6 looping
- Switch $status[$i]
- Case 0
- $pressedTime[$i] = 0
- Case 1
- If $pressedTime[$i] >= $doubleClickInterval Then
- $status[$i] = 4
- ElseIf $releasedTime[$i] >= $doubleClickInterval Then
- $status[$i] = 5
- Else
- $status[$i] = 2
- EndIf
- Case 2
- If $pressedTime[$i] >= $doubleClickInterval Then
- $status[$i] = 4
- ElseIf $releasedTime[$i] >= $doubleClickInterval Then
- $status[$i] = 5
- EndIf
- EndSwitch
- Switch $status[$i]
- Case 3
- $releasedTime[$i] = $doubleClickInterval
- $pressedTime[$i] = 0
- $status[$i] = 0
- MsgBox(4096, "Title", "Double pressed: "&$names[$i]&"")
- Case 4
- $releasedTime[$i] = $doubleClickInterval
- $pressedTime[$i] = 0
- $status[$i] = 0
- MsgBox(4096, "Title", "Long pressed: "&$names[$i]&"")
- Case 5
- $releasedTime[$i] = $doubleClickInterval
- $pressedTime[$i] = 0
- $status[$i] = 0
- MsgBox(4096, "Title", "Single pressed: "&$names[$i]&"")
- EndSwitch
- EndIf
- Next
- WEnd
- DllClose($dll)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement