My while loop isnt working

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
monkeyman5032
Posts: 3
Joined: 20 Sep 2018, 19:10

My while loop isnt working

23 Sep 2018, 13:57

So im trying to make an autoclicker of sorts but when i press crtl j it only returns 1 enter instead of doing it every 100 milliseconds.
Here is the code:

toggle = 0
#MaxThreadsPerHotkey 2

^j::
Toggle := !Toggle
While Toggle
{
send, {Enter}
sleep 100
}
Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: My while loop isnt working

24 Sep 2018, 00:50

Hallo,
it worked for me. Maybe you pressed "crtl j" too long?
So better with hotkey "^j Up":

Code: Select all

toggle = 0
#MaxThreadsPerHotkey 2
^j Up::
Toggle := !Toggle
While Toggle
{
	send, {Enter}
	sleep 100
}
Return
monkeyman5032
Posts: 3
Joined: 20 Sep 2018, 19:10

Re: My while loop isnt working

24 Sep 2018, 10:06

That still doesnt work for me. Could the problem be related to my computer? Windows 10, 64 bit, AHK version 1.1.30.00
MannyKSoSo
Posts: 440
Joined: 28 Apr 2018, 21:59

Re: My while loop isnt working

24 Sep 2018, 10:11

you could do a check to make sure that it is only triggering once by doing this

Code: Select all

^j Up:: Send, t
This will only send it once, but if its triggering more than once then a problem has occurred.
monkeyman5032
Posts: 3
Joined: 20 Sep 2018, 19:10

Re: My while loop isnt working

24 Sep 2018, 10:12

Nvrm it just started working. thanks all

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: CrowexBR, doodles333, vysmaty and 244 guests