Bharath Gupta
Bharath Gupta

Reputation: 344

Automatically triggering a button

I am new to AutoIt. I want to run my code without hitting or pressing the "ok" button that appears when the MsgBox is called.

My code is as follows:

$val = 10
For $i = 1 To 59
     $doubled = MyDouble($val)
     sleep(100)
     MsgBox(0, "", $val & " doubled is " & $doubled )
     $val = $doubled
Next
    MsgBox(0,"the value  ","The final vaule is as  " & $val)
Exit
Func MyDouble($value)
     $value = $value * 2
     Return $value       
 EndFunc

Upvotes: 0

Views: 790

Answers (1)

aphoria
aphoria

Reputation: 20179

You can use a timeout on the MsgBox.

From the AutoIt help...

MsgBox ( flag, "title", "text" [, timeout [, hwnd]] )

So you could do this to have a 1 second timeout:

MsgBox(0, "", $val & " doubled is " & $doubled, 1)

Upvotes: 1

Related Questions