5

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
}
George
  • 4,514
  • 17
  • 54
  • 81

2 Answers2

4

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/

Sid
  • 1,709
  • 1
  • 10
  • 17
2

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

    Loop
    {
      ; Your other code goes here 
    }
Sushrut Kanetkar
  • 363
  • 3
  • 13