Jump to content

Loop while window active


Recommended Posts

I am trying to have a loop occur while a window is active. Basically whenever the window "search" search is open/active I want the code to constantly check for certain control fields. Once the window closes I want it to end the loop. The problem is I couldn't find the right syntax to do this. Here is some of the pseudo code that I am using.

Any help would be great, Thanks

Dim $Last   ;control id 213
Dim $First  ;control id 211
Dim $DOB    ;control id 220
Dim $Text


;while WinWaitActive("search")
sleep(100)
$Last = ControlGetText ( "search", "", 213 )
$First = ControlGetText ( "search", "", 211 )
$DOB = ControlGetText ( "search", "", 220 )

;wend WinWaitClose("search")

msgbox(0,"here it is", $Last & $First & $DOB)
exit
Link to comment
Share on other sites

  • Moderators

While WinActive('Search')
  ;something
WEnd

Edit:

This actually looks more like what your looking for though:

Global $Last    ;control id 213
Global $First    ;control id 211
Global $DOB    ;control id 220
Global $Text

AdlibEnable('_CheckForWindow', 10)

While 1
    Sleep(3000)
WEnd

Func _CheckForWindow()
    If WinActive('Search') Then
        AdlibDisable()
        While WinActive('Search')
            $Last = ControlGetText ( "search", "", 213 )
            $First = ControlGetText ( "search", "", 211 )
            $DOB = ControlGetText ( "search", "", 220 )
            Sleep(10)
        WEnd
        AdlibEnable('_CheckForWindow', 10)
    EndIf
EndFunc
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...