-
Notifications
You must be signed in to change notification settings - Fork 2
/
Simple Example.ahk
35 lines (30 loc) · 1.28 KB
/
Simple Example.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
/*
Simplest example of using the wooting wrapper for input only
Demos Analog and Digital input, and how to create WootingKeys
*/
#include Lib\WootingAHK.AHK
; Start up the WootingAHK library
Wooting := new WootingAHK()
; Create a wrapper for the "A" key
wootingKey := Wooting.AddKey(GetKeySC("A")) ; Create a WootingKey for the A key using the Scan Code
.OnAnalog(Func("AxisChanged")) ; (Optional) Call the Function "AxisChanged" and pass it Analog value
.OnDigital(Func("HotkeyChanged")) ; (Optional) Call the Function "HotkeyChanged" and pass it Digital value
.SetBlock(true) ; (Optional) Enable blocking for the hotkey
;.SetWinTitle("ahk_class Notepad") ; (Optional) Only enable the hotkey in Notepad
.SetHotkey(true) ; (Optional) Turn on the hotkey
return
; Called and passed digital value when key changes state
; value will be 1 for pressed, 0 for released
HotkeyChanged(value){
MouseGetPos, x, y
ToolTip % "Hotkey Changed. Value: " value " @ " A_TickCount, x + 20, y-10, 1
}
; Called and passed analog value when key changes state
; value will be 0 for released, through to 255 for fully pressed
AxisChanged(value){
MouseGetPos, x, y
ToolTip % "Axis Changed. Value: " value " @ " A_TickCount, x + 20, y+10, 2
}
^Esc::
Wooting.Dispose() ; Reset RGB
ExitApp