Advertisement
alexdubovyck

Узнать что за клавиши на руле\джойстике\педальках

Mar 1st, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.26 KB | None | 0 0
  1. ; #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ; #Warn ; Enable warnings to assist with detecting common errors.
  3. ; SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
  4. ; SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
  5.  
  6. ;joy1 это правый шифт за рулём
  7. ;joy2 это левый шифт за рулём
  8. ;joy3 это x
  9. ;joy4 это вадрат
  10.  
  11. ; joy7::Send 666
  12. ; return
  13.  
  14. ; r::reload
  15. ; return
  16.  
  17.  
  18.  
  19. ; Joystick Test Script
  20. ; http://www.autohotkey.com
  21. ; This script helps determine the button numbers and other attributes
  22. ; of your joystick. It might also reveal if your joystick is in need
  23. ; of calibration; that is, whether the range of motion of each of its
  24. ; axes is from 0 to 100 percent as it should be. If calibration is
  25. ; needed, use the operating system's control panel or the software
  26. ; that came with your joystick.
  27.  
  28. ; July 6, 2005: Added auto-detection of joystick number.
  29. ; May 8, 2005 : Fixed: JoyAxes is no longer queried as a means of
  30. ; detecting whether the joystick is connected. Some joysticks are
  31. ; gamepads and don't have even a single axis.
  32.  
  33. ; If you want to unconditionally use a specific joystick number, change
  34. ; the following value from 0 to the number of the joystick (1-16).
  35. ; A value of 0 causes the joystick number to be auto-detected:
  36. JoystickNumber = 0
  37.  
  38. ; END OF CONFIG SECTION. Do not make changes below this point unless
  39. ; you wish to alter the basic functionality of the script.
  40.  
  41. ; Auto-detect the joystick number if called for:
  42. if JoystickNumber <= 0
  43. {
  44. Loop 16 ; Query each joystick number to find out which ones exist.
  45. {
  46. GetKeyState, JoyName, %A_Index%JoyName
  47. if JoyName <>
  48. {
  49. JoystickNumber = %A_Index%
  50. break
  51. }
  52. }
  53. if JoystickNumber <= 0
  54. {
  55. MsgBox The system does not appear to have any joysticks.
  56. ExitApp
  57. }
  58. }
  59.  
  60. #SingleInstance
  61. SetFormat, float, 03 ; Omit decimal point from axis position percentages.
  62. GetKeyState, joy_buttons, %JoystickNumber%JoyButtons
  63. GetKeyState, joy_name, %JoystickNumber%JoyName
  64. GetKeyState, joy_info, %JoystickNumber%JoyInfo
  65. Loop
  66. {
  67. buttons_down =
  68. Loop, %joy_buttons%
  69. {
  70. GetKeyState, joy%A_Index%, %JoystickNumber%joy%A_Index%
  71. if joy%A_Index% = D
  72. buttons_down = %buttons_down%%A_Space%%A_Index%
  73. }
  74. GetKeyState, JoyX, %JoystickNumber%JoyX
  75. axis_info = X%JoyX%
  76. GetKeyState, JoyY, %JoystickNumber%JoyY
  77. axis_info = %axis_info%%A_Space%%A_Space%Y%JoyY%
  78. IfInString, joy_info, Z
  79. {
  80. GetKeyState, JoyZ, %JoystickNumber%JoyZ
  81. axis_info = %axis_info%%A_Space%%A_Space%Z%JoyZ%
  82. }
  83. IfInString, joy_info, R
  84. {
  85. GetKeyState, JoyR, %JoystickNumber%JoyR
  86. axis_info = %axis_info%%A_Space%%A_Space%R%JoyR%
  87. }
  88. IfInString, joy_info, U
  89. {
  90. GetKeyState, JoyU, %JoystickNumber%JoyU
  91. axis_info = %axis_info%%A_Space%%A_Space%U%JoyU%
  92. }
  93. IfInString, joy_info, V
  94. {
  95. GetKeyState, JoyV, %JoystickNumber%JoyV
  96. axis_info = %axis_info%%A_Space%%A_Space%V%JoyV%
  97. }
  98. IfInString, joy_info, P
  99. {
  100. GetKeyState, joyp, %JoystickNumber%JoyPOV
  101. axis_info = %axis_info%%A_Space%%A_Space%POV%joyp%
  102. }
  103. ToolTip, %joy_name% (#%JoystickNumber%):`n%axis_info%`nButtons Down: %buttons_down%`n`n(right-click the tray icon to exit)
  104. Sleep, 100
  105. }
  106. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement