Reputation: 557
The script is intended to break the loop on XButton1, but fails.
I am a newbie in AHK scripting and a really simple script I made is not working as intended. I googled it and it works on everyone.
ended = false
XButton1::
ended = true
return
$XButton2::
ended = false
Loop
{
if (ended = true)
{
break
}
MouseClick left
Sleep 10
}
return
It was supposed to click infinitely until Mouse4 (XButton1) is pressed. But it does not stop when I click it.
I also checked other StackOverflow posts and nothing solved it.
Upvotes: 1
Views: 143
Reputation: 837
Your code uses legacy-syntax which was a major headache for me (and I believe many others) when I was starting with AHK.
To make your code work change:
if (ended = true)
to
if (ended = "true")
Consider switching to :=
(SetExpression) instead of =
For example:
ended = false
should become
ended := false
Upvotes: 2