5
votes

Is there a way to create something like this in AutoHotKey?

bool isReady = false;
while (!isReady) {
   // Do something here
   isReady = true;
}

I tried to experiment with While loop, but it ended with just 1 loop regardless of the condition I give the program. I am currently using Version 1.0.47.06.

I read the documentation here: http://www.autohotkey.com/docs/commands/While.htm I tried to give the while loop a value of true. But it only executed once. (I was expecting it to loop forever, until I terminate the script).

condition := true

while (condition)
{
    MsgBox, condition
}

while (true)
{
    MsgBox, true
}
2

2 Answers

4
votes

Your code is correct, but the While command requires version 1.0.48+.

You should update to the latest version of AHK here - http://ahkscript.org/download/

2
votes

To create a infinite loop , you can use this syntax:

    Loop
    {
      ; Your other code goes here 
    }