Welcome to the forum RandomClown,
RandomClown, on Oct 29 2008, 09:07 AM, said:
How would I set 2 conditions in a While statement?
- There is the i++ thing something like that I saw in the very useful help file
- Where is the &&?
AutoIt supports only the operators under "Language Reference" catagory in the help file supplied within the installation of AutoIt3.
Quote
I want to set a While() with these conditions:
- Run at most 10 times
- Check if "Some Window" is up
You may use as Nick White displays or you could use a For...Next loop that is suitable for limited looping by using a counter variable. Using AdlibEnable() function may also be suitable for detection in your script. The choice is for you to make. I made example code below.
; title of test window
$title = 'Target Window'
; create a window to test with
GUICreate($title)
GUISetState()
; run the _Adlib() function every 2 seconds to check for the test window
AdlibEnable('_Adlib', 2000)
Sleep(2000)
; activate the test window if needed
If Not WinActive($title) Then
WinActivate($title)
EndIf
; loop 10 times
For $i = 1 To 10
; check if test window is active
If WinActive($title) Then
; disable the _Adlib() function check
AdlibDisable()
; show the result
SplashTextOn('For...Next Loop', 'Window is active', 200, 50)
Sleep(2000)
SplashOff()
; enable the _Adlib() function check
AdlibEnable('_Adlib', 2000)
; exit the For...Next Loop
ExitLoop
EndIf
Sleep(500)
Next
Sleep(5000)
Exit
Func _Adlib()
; Adlib function to show result while the main code is executing
SplashTextOn('_Adlib() function', 'Window is active', 200, 50)
Sleep(1000)
SplashOff()
Sleep(250)
EndFunc
Quote
...hmm I just saw this right now: "ExitLoop".
I could do an If("Some Window" is up){ExitLoop} [of course in AutoIT language], but I want to cut off 3 lines from the tiny check script if possible.
Single line
If...Then... are allowed though your mention of removing 3 lines is beyond my understanding to answer with the information supplied.