-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathjoylist.ahk
68 lines (63 loc) · 1.28 KB
/
joylist.ahk
1
2
3
4
5
6
7
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
; Based on Joystick Test Script by www.autohotkey.com
; joyfocus 1.1 LazyTech
EveryDevice := Object()
Loop 16 ; Query each joystick number to find out which ones exist.
{
GetKeyState, JoyName, %A_Index%JoyName
GetKeyState, JoyButtons, %A_Index%JoyButtons
GetKeyState, JoyInfo, %A_Index%JoyInfo
GetKeyState, JoyX, %A_Index%JoyX
GetKeyState, JoyY, %A_Index%JoyY
if JoyName <>
{
JoystickNumber := A_Index
if JoyX
{
JoyInfoX := "X axis`n"
}
if JoyY
{
JoyInfoY := "Y axis`n"
}
IfInString, JoyInfo, Z
{
JoyInfoZ := "Z axis`n"
}
IfInString, JoyInfo, R
{
JoyInfoR := "R axis`n"
}
IfInString, JoyInfo, U
{
JoyInfoU := "U axis`n"
}
IfInString, JoyInfo, V
{
JoyInfoV := "V axis`n"
}
IfInString, JoyInfo, P
{
IfInString, JoyInfo, D
{
JoyInfoP := " and a digital POV hat"
}
else
{
JoyInfoP := " and an analog POV hat"
}
}
EveryDevice[A_Index] := JoyName " with " JoyButtons " buttons" JoyInfoP ". `nWe've detected the following analog axis : `n`n" JoyInfoX JoyInfoY JoyInfoZ JoyInfoR JoyInfoU JoyInfoV
;break
}
}
if JoystickNumber <= 0
{
MsgBox The system does not appear to have any joysticks.
ExitApp
}
#SingleInstance
for index, element in EveryDevice
{
MsgBox % "Device " . index . " is " . element
}
return