Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AutoHotKey infinite while loop

Tags:

autohotkey

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
}
like image 541
George Avatar asked Nov 12 '14 19:11

George


2 Answers

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/

like image 115
Sid Avatar answered Sep 24 '22 13:09

Sid


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

    Loop
    {
      ; Your other code goes here 
    }
like image 25
Sushrut Kanetkar Avatar answered Sep 22 '22 13:09

Sushrut Kanetkar