Windows 10 64-bit v1903 build 18362.418
Is this a bug, or my stupidity? KeyWait seems to ignore the key state for XButtonx.
Here's the test code, executed with no other scripts in memory:
Code: Select all
If Not A_IsAdmin
{
Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
ExitApp
}
#Persistent
#SingleInstance Force
#NoEnv
#InstallKeybdHook
#InstallMouseHook
#MaxThreadsPerHotkey 1
#MaxThreadsBuffer Off
#KeyHistory 1000
#MaxHotKeysPerInterval 200
SetTitleMatchMode 2
SetTitleMatchMode Slow
SendMode Input
DetectHiddenWindows, On
OnExit, QUIT
#IfWinActive, ahk_class AutoHotkey
$XButton1::
KeyWait, XButton1, T1
If ( ErrorLevel != 0 )
{
MsgBox, Long click
}
Else
{
MsgBox, Short click
}
Return
#IfWinActive
QUIT:
ExitApp
Code: Select all
A2 01D d 0.03 LControl
4B 025 d 0.00 k
4B 025 u 0.09 k
A2 01D u 0.09 LControl
74 03F d 0.28 F5
74 03F u 0.14 F5
05 000 h d 1.88 XButton1
05 000 h u 9.20 XButton1
74 03F d 0.66 F5