Hi, I'm using a script I found here on the forum to detect a user mouse click and continue the macro. It performs some mouse click and keystrokes before this script is encountered, and the first run through, it often has a false positive click detection when no click was actually performed. Even with a 1 second delay in front, I still get errors intermittently. Is there a way to reset the key state or a better script that would be more reliable?
Extra details: I'm running these executables with Autohotkey triggers. Quite strangely, I have a completely separate macro that I use frequently, and at the end of it, it presses the hotkey to trigger this macro with the bug. But when my buggy macro is triggered by that other macro, the error occurs less frequently.
Thank you.
Label>Loop
LibFunc>user32,GetAsyncKeyState,keystate,1
Wait>0.04
If>keystate<>0
Message>Great answer
Wait>0.35
PushButton>Macro Scheduler Message,&OK
Wait>.6
Goto>Postloop
endif
Goto>Loop
Label>Postloop
Mouse Click Detector - Bug
Moderators: JRL, Dorian (MJT support), Phil Pendlebury
Re: Mouse Click Detector - Bug
Code: Select all
OnEvent>Key_Down,VK01,0,srtClick
Let>Keystate=0
Label>Loop
Wait>0.04
If>keystate<>0
Let>Keystate=0
Message>Great answer
Wait>0.35
PushButton>Macro Scheduler Message,&OK
Wait>.6
Goto>Postloop
endif
Goto>Loop
Label>Postloop
SRT>srtClick
Let>keystate=1
END>srtClick