examples
Code: Select all
;- http://www.autohotkey.com/board/topic/15574-morse-find-hotkey-press-and-hold-patterns/
;- http://www.autohotkey.com/board/topic/9166-fkee3/
;- http://www.autohotkey.com/board/topic/35566-rapidhotkey/
; !n::run,notepad ;- a hotkey example alt+n
;------- example -------
;- push F1 twice or 3*
;- write this above the F1-key :
; 2* notepad
; 3* calc
$F1::
p := Morse()
If (p = "00")
run, notepad
If (p = "000")
run,calc
return
$F12::
p := Morse()
If (p = "00")
msgbox, 262144, F12-Key, F12 2 * pushed,2
If (p = "000")
msgbox, 262144, F12-Key, F12 3 * pushed,2
return
;--------------------------------------------------
Morse(timeout = 400)
{
tout := timeout/1000
key := RegExReplace(A_ThisHotKey,"[\*\~\$\#\+\!\^]")
Loop
{
t := A_TickCount
KeyWait %key%
Pattern .= A_TickCount-t > timeout
KeyWait %key%,DT%tout%
If (ErrorLevel)
Return Pattern
}
}
return
;===================================================