The script should move my mouse when Ctrl and LButton is pressed with a loop and a break when Ctrl is released, but instead it keeps an Infinite Loop, forcing me to abort the script.
It is worth remembering that the script worked correctly for a long time, it began to happen suddenly.
I've tried some small variations with Loop (including Loop with number), Break and etc but despite solving the problem of "infinite loop" the Script does not work the desired way. I have already tried to uninstall AHK and install other versions but it did not read my script any more normally.
On other machines it works perfectly. Any suggestions?
Code: Select all
#NoEnv
SendMode Input
~F6::Suspend
~F2::ExitApp
LCtrl & ~LButton::
loop
If GetKeyState("LButton", "LCtrl") {
Sleep, 5
moveAmount := (moveAmount = 2) ? 1 : -1
mouseXY(moveAmount,3.4)
}
else
break
Return
mouseXY(x,y)
{
DllCall("mouse_event",int,2,int,x,int,y,uint,0.5,uint,0.5)
}