Advertisement
SharkyEXE

Untitled

Dec 10th, 2022
2,644
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 4.74 KB | None | 0 0
  1.  
  2. #include <Misc.au3>
  3. 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]
  4. 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']
  5. 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]
  6. 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]
  7. 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]
  8.  
  9. $dll = DllOpen('user32.dll')
  10.  
  11. $loopDelay = 10
  12. $doubleClickInterval = 300
  13. $continue = 1
  14.  
  15. While $continue
  16.    Sleep($loopDelay)
  17.    If _IsPressed(Hex(9), $dll) Then
  18.       $continue = 0
  19.    EndIf
  20.    For $i = 0 To UBound($pressedTime) - 1
  21.  
  22.       If _IsPressed(Hex($codes[$i]), $dll) Then
  23.          $pressedTime[$i] += $loopDelay
  24.  
  25.          If $pressedTime[$i] > $doubleClickInterval Then
  26.             $status[$i] = 0
  27.             MsgBox(4096, "Title", "Long pressed: "&$names[$i]&"")
  28.             ContinueLoop
  29.          EndIf
  30.  
  31.          If $status[$i] == 2 Then
  32.             If $releasedTime[$i] >= $doubleClickInterval Then
  33.                $status[$i] = 5
  34.             Else
  35.                $status[$i] = 3
  36.             EndIf
  37.          ElseIf $status[$i] == 0 Then
  38.             $status[$i] = 1
  39.          EndIf
  40.  
  41.          $releasedTime[$i] = 0
  42.       Else
  43.          If $releasedTime[$i] < $doubleClickInterval Then
  44.             $releasedTime[$i] += $loopDelay
  45.          EndIf
  46.  
  47. ;~ 0 blocked
  48. ;~ 1 ready
  49. ;~ 2 waiting
  50. ;~ 3 double press
  51. ;~ 4 long press
  52. ;~ 5 single press
  53. ;~ 6 looping
  54.  
  55.       Switch $status[$i]
  56.                Case 0
  57.                   $pressedTime[$i] = 0
  58.                Case 1
  59.                   If $pressedTime[$i] >= $doubleClickInterval Then
  60.                      $status[$i] = 4
  61.                   ElseIf $releasedTime[$i] >= $doubleClickInterval Then
  62.                      $status[$i] = 5
  63.                   Else
  64.                      $status[$i] = 2
  65.                   EndIf
  66.                Case 2
  67.                   If $pressedTime[$i] >= $doubleClickInterval Then
  68.                      $status[$i] = 4
  69.                   ElseIf $releasedTime[$i] >= $doubleClickInterval Then
  70.                      $status[$i] = 5
  71.                   EndIf
  72.  
  73.       EndSwitch
  74.  
  75.       Switch $status[$i]
  76.                Case 3
  77.                   $releasedTime[$i] = $doubleClickInterval
  78.                   $pressedTime[$i] = 0
  79.                   $status[$i] = 0
  80.                   MsgBox(4096, "Title", "Double pressed: "&$names[$i]&"")
  81.                Case 4
  82.                   $releasedTime[$i] = $doubleClickInterval
  83.                   $pressedTime[$i] = 0
  84.                   $status[$i] = 0
  85.                   MsgBox(4096, "Title", "Long pressed: "&$names[$i]&"")
  86.                Case 5
  87.                   $releasedTime[$i] = $doubleClickInterval
  88.                   $pressedTime[$i] = 0
  89.                   $status[$i] = 0
  90.                   MsgBox(4096, "Title", "Single pressed: "&$names[$i]&"")
  91.       EndSwitch
  92.  
  93.       EndIf
  94.    Next
  95. WEnd
  96.  
  97. DllClose($dll)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement