I tried few different methods with AKH Documentation or merging codes that i found. It's to extend functionality of a key for Single, Double or Long Tap.
Code: Select all
#SingleInstance force
LShift::
analyseKeyPress("b","/","{LShift Down}","{LShift Up}")
return
LControl::
analyseKeyPress("/","e","{LControl Down}","{LControl Up}")
return
F12::
analyseKeyPress("5","1","{LShift Down}^{Space Down}","{LShift Up}^{Space Up}")
return
F12 up::
test = 1
return
analyseKeyPress(singlekey,doublekey,longkey1,longkey0){ ;
doubleKeySpeed:=0.2
longKeyPressTime:=0.3
keywait, %A_thisHotkey%, t%longKeyPressTime%
if errorLevel{
sendinput, %longkey1%
KeyWait, %A_thisHotkey%
sendinput, %longkey0%
}else{
keywait, %A_thisHotkey%, d t%doubleKeySpeed%
if errorLevel{
sendinput, %singlekey%
}else{
sendinput, %doublekey%
}
}
return
}
return
- b (Single Click)
- / (Double Tap)
- Holding Shift (Hold)
I found a topic for Wacom tablet and it looks like the same idea. https://autohotkey.com/boards/viewtopic.php?t=10358
I modified this for single, double and long:
Code: Select all
F12::
Return
F12 Up::
If (A_PriorHotKey = "F12" AND A_TimeSincePriorHotkey > 400) {
SendInput, u
} else if (A_PriorHotKey = "f12" AND A_TimeSincePriorHotkey < 100) {
if (presses > 0) {
SendInput, d ;DOUBLE
presses = 0
} else {
presses +=1
}
} else {
SendInput, s
}
Return
I tried modifying like this:7B 058 h d 7.25 F12
7B 058 h u 4.31 F12
55 016 i d 0.00 u
55 016 i u 0.00 u
Code: Select all
$x::
if GetKeyState("x", "P") {
SendInput, x
} else {
If (A_PriorHotKey = "$x Up" AND A_TimeSincePriorHotkey < 400) {
SendInput, d
} Else {
SendInput, h
}
}
return
$x Up::
If (A_PriorHotKey = "$x" AND A_TimeSincePriorHotkey > 400) {
SendInput, l
}
Return
Long story short I want to create a button for my drawing tablet that with one tap changes to Brush (b) double tap should change to last preset (/) and only when holding it should hold Shift to be able to change brush size.
With this i should be able to create rest of the buttons [single][double][long_down][long_up]. Examples: [a](holding) or [a](when holding send c once, and when stopped send another c to reset).
I wanted to create everything in arrays and loop, but don't know how to create hotkeys inside code and without a lot of labels.