Help with a Loop

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Limitd
Posts: 2
Joined: 08 Aug 2022, 20:58

Help with a Loop

Post by Limitd » 08 Aug 2022, 21:02

Hey, just trying to get a loop to run, the whole program has worked perfectly before this.

Using a Loop as such

Code: Select all


Random, loopaa, 20, 30
Loop, loopaa{
      send, {SPACE down}
      Sleep, 25
    }
Skips the loop entirely. But using a set value of 20 instead of the variable seems to work fine.

Now I've tried setting loopaa to 20 and still that skips the loop, can we not use variables in loops?

User avatar
boiler
Posts: 16952
Joined: 21 Dec 2014, 02:44

Re: Help with a Loop

Post by boiler » 08 Aug 2022, 21:31

Yes, you can use variables. You either need to surround it with % or force an expression:

Code: Select all

Loop, %loopaa% {
or

Code: Select all

Loop, % loopaa {

Post Reply

Return to “Ask for Help (v1)”