Jump to content

Window wait until the next window getting Open without sleep time.


Recommended Posts

Hi Guy's,

How do I wait Until the Next windows getting open without Sleep time.

There is some process(Loading) from Current window to Next coming windows, So The code should wait until the next windows opens.

Thank You.

Regards,
Chaitanya K.
Link to comment
Share on other sites

The command you're looking for is Winwait/WinwaitActive.

  WinWait ( "title" [, "text" [, timeout = 0]] )

  WinWaitActive ( "title" [, "text" [, timeout = 0]] )

If it' the same application use the text to differentiate them, otherwise you can get away with specifying only the window name.

Recommend reading through the help file (Press F1 when in script editor) you'll find alot of useful functions and their names in the scrollbox to the left.
Best of luck.

Edited by enRAYYY
Link to comment
Share on other sites

Thank You for ur Rely enRAYYY......

But Those two methods are not wait until New window get opens

 WinWaitActive("[CLASS:TTabSheet; INSTANCE:1]")

 WinWaitActive("[CLASS:TTabSheet; INSTANCE:1]","",10)

 WinWait("[CLASS:TTabSheet; INSTANCE:1]")

 WinWait("[CLASS:TTabSheet; INSTANCE:1]","",10)

 

like above i tried with TimeOut Parameters and without TimeOut parameter also But not waiting the Script........

 

Edited by ChaitanyaK
Regards,
Chaitanya K.
Link to comment
Share on other sites

I tried like below...........

Do
                                    Sleep(4000)
                                Until WinWait("[CLASS:TofrmUpdate_Schedule_Event; INSTANCE:1]");("[CLASS:TofrmUpdate_Schedule_Event; INSTANCE:1]") 

                                If WinExists("[CLASS:TofrmUpdate_Schedule_Event; INSTANCE:1]") Then
                                    MsgBox(0,"Success","After V Active")
                                 Else
                                    MsgBox(0,"Fail","Booo")
                                 EndIf

The windows which i want to Wait is Sub Window(Windows under Window)

Cany anybody help me.....

Edited by ChaitanyaK
Regards,
Chaitanya K.
Link to comment
Share on other sites

13 hours ago, jpm said:

Use the AutoIt info Tools to find the exact Title of the subwindow

Okay. jpm Thank you for your reply......When i placed Finder Tool on my Subwindow. i am getting parentWindows Tiltle only and getting Subwindows CLASS.

Below is my InfoTool Information. 

ParentWindowTitle.png

Regards,
Chaitanya K.
Link to comment
Share on other sites

Maybe you need something like this:
 

Func _CompareWinList($aBeforeWinList, $aAfterWinList)
    ; ----------------------------------------------------------------------------------------------
    ; The two arrays were filled at different points in time using GetWinList()
    ; the function does imply that in the second array ($aAfterWinList) are more windows and returns
    ; an array with all "new" or additional windows
    ; Format for Before-, After- and Return-Array:
    ; [0][0]=Elementcount (x)
    ; ...
    ; [x][0]=Title
    ; [x][1]=Handle
    ; ----------------------------------------------------------------------------------------------
    Local $hAfterWin, $hBeforeWin
    Local $aCompareWinListResult[1][2]
    Local $iCompareWinListResult

    ; ### Still lacks the part in which the function ensures that all parameters are array (and filled correctly)

    ; Loop through the "After" array, comparing all elements of the "Before" array
    For $i = 1 To $aAfterWinList[0][0]
        $hAfterWin = $aAfterWinList[$i][1] ; Handle in Variable übernehmen

        For $j = 1 To $aBeforeWinList[0][0]
            $hBeforeWin = $aBeforeWinList[$j][1] ; Handle in Variable übernehmen

            ; if handle from After-List is also in Before-List ist,
            ; investigate next after-entry
            If $hAfterWin = $hBeforeWin Then ExitLoop
        Next ; no match till now, next Before-List entry

        ; If we end up here, and after-entry did not match, copy entry to result-array
        If $hBeforeWin <> $hAfterWin Then
            $iCompareWinListResult = UBound($aCompareWinListResult) ; Anzahl der bisherigen Elemente ermitteln
            ReDim $aCompareWinListResult[$iCompareWinListResult + 1][2] ; Array um ein Element erweitern
            $aCompareWinListResult[0][0] = UBound($aCompareWinListResult) - 1 ; Neue Anzahl der Elemente-1 in Index-Element schreiben
            $aCompareWinListResult[$iCompareWinListResult][0] = $aAfterWinList[$i][0] ; Titel aus After-Liste in Ergebnis-Element übernehmen
            $aCompareWinListResult[$iCompareWinListResult][1] = $aAfterWinList[$i][1] ; Handle aus After-Liste in Ergebnis-Element übernehmen
        EndIf
    Next
    Return $aCompareWinListResult
EndFunc   ;==>_CompareWinList

(didn't have the time to translate all comments to english, but most of the lines are quite self explaning.

it's a small helper function i did once, all you have to do is fill an array using GetWinlist before, and one array after you "think" the new window shloud be there. then let it compare and check the "result array" againts the known windowclass, title or whatever. the filling, comparing and checking should be done in a loop, as it is not exactly known when the new windows will be there.

i recommend a "no deadlock" loop construction, like trying 100 times with some ms sleep to avoid a endless running loop. as it is a good practice to always have an exit criteria in a loop:)

Hope this helps.

Edited by KnutJ

rsRVpv.gif

Link to comment
Share on other sites

6 hours ago, ChaitanyaK said:

Okay. jpm Thank you for your reply......When i placed Finder Tool on my Subwindow. i am getting parentWindows Tiltle only and getting Subwindows CLASS.

Below is my InfoTool Information. 

ParentWindowTitle.png

The class you are using is for a control not a Windows. I don't know what you are saying for a subwindows

You have to use  the class or the title of a WINDOWS

Link to comment
Share on other sites

21 hours ago, jpm said:

The class you are using is for a control not a Windows. I don't know what you are saying for a subwindows

You have to use  the class or the title of a WINDOWS

Yes. Actually I have Subwindow, but When i Place Finder Tool on my subwindow. I am getting like above Image.........

So Which Process i should use for wait the code for next window or windows.

Regards,
Chaitanya K.
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...