1
votes

here's my ahk file, spam F5 + click (while hold):

$*F5::
Loop {
    if not GetKeyState("F5", "P")
    break
    Send, {f5}
    Click
}

how to make sure the loop only stops when CLICK is sent (after f5)? sometimes the loop is ending in the F5 and the click is not sent

thank you

2

2 Answers

1
votes

Using click sends a click to the current mouse location, which might be away from the location you want. Make sure that the current mouse position is at the desired location. Try to add the following in your code to display current mouse position and active window.

CoordMode,Mouse,Screen
MouseGetPos,mpx,mpy
tooltip, mouseposition = %mpx%.%mpy%, 1,1
sleep 5000
WinGetTitle, windowTitle, A
tooltip, Active Window = %windowTitle%, 1,1
sleep 5000
0
votes

try the following instead of Click

Send Click

does it work?