Why isn't my code working? (Loop)

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Bertorrr
Posts: 2
Joined: 14 Jan 2022, 15:30

Why isn't my code working? (Loop)

Post by Bertorrr » 18 Jan 2022, 09:38

Code: Select all

#Warn

^j::

Loop, 15
{

	x := 0

	x := x + 1

	Send %x%

	Sleep, 1000

	if (x < 10)
		continue
	
	if (x > 10)
		break

}
[Mod edit: [code][/code] tags added.]
Last edited by gregster on 18 Jan 2022, 11:04, edited 1 time in total.
Reason: Topic moved from 'AHK Studio' subforum.

Bertorrr
Posts: 2
Joined: 14 Jan 2022, 15:30

Re: Why isn't my code working? (Loop)

Post by Bertorrr » 18 Jan 2022, 09:39

The problem is that I'm trying to get it to add 1 to x and type that in, but it won't add, it will keep typing 1. Thank you!

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Why isn't my code working? (Loop)

Post by swagfag » 18 Jan 2022, 10:55

Bertorrr wrote:
18 Jan 2022, 09:39
it will keep typing 1
and it will continue doing so for as long as u keep resetting x back to 0 upon every new loop iteration

Post Reply

Return to “Ask for Help (v1)”