#Requires AutoHotkey v2.0

~LButton:: {
time := 1000 ; マウスボタンを押し続ける時間 milliseconds
key := "a" ; 連打するキー
interval := 40 ; 連打間隔 milliseconds

this_hotkey := LTrim(ThisHotkey, "~")
while GetKeyState(this_hotkey, "P") {
if (A_TimeSinceThisHotkey >= time) {
;ToolTip key " mashing"
send key
sleep interval
}
else {
;ToolTip A_Index
sleep 100
}
}
}
;~LButton up:: ToolTip