Jump to content

Recommended Posts

Posted

Hy @ all and thank you for your support in advance. :ph34r:

A setup does not run the way I expected, therefor I would like to wait for different windows at the same time. One is called Info, the other Complete.

If WinWaitActive ( "Info") OR ("Complete") Then

$Tile = WinGetTitle ("","")

If $Title = "Info" Then

..

Else

..

EndIf

EndIf

I've also tried something like

Select

Case

WinWaitActive = "Info"

..

EndSelect

I just don't know how to make this work. It seems to me like Autoit just ignores the second title, but I need this one.

I also thought of a scan that includes something like

Do WinExist ...

Sleep (3000)

Until ...

If ... then

Endif

but the window pops up after after a long time, and there has to be be a nice solution.

Hope you understand my problem :lol:

So please, do't hesitate to write any idea. :(

Posted

so you want to check if one of two windows exists? and wait until one of them exists?

try this:

While NOT WinExists('Window1') AND NOT WinExists('Window2')
  Sleep(100)
WEnd

I didn't test, but it should work.

Greetings,

ZeD

Posted

I would like to wait for different windows at the same time.

In the code you show below:

If WinWaitActive ( "Info") OR ("Complete") Then
$Tile = WinGetTitle ("","")
If $Title = "Info" Then
..
Else
..
EndIf
EndIf

This will not work as 2 windows cannot be "Active" at the same time. Are you trying to check if the 2 windows exist on the screen at the same time? If so, you want the WinExists() function. The code to wait until the windows exist is:

; Wait until the 2 windows exist
While Not (WinExists("Info") And WinExists("Complete"))
  ; Do not do anything, we are just waiting this out
WEnd

I hope this is what you are looking for, because what you requested does not make sense. If this doesn't help then please clairify the problem for me so I can try to help you further.

*** Matt @ MPCS

Posted

let's see if I understand, you're waiting for two different windows, either one could come up first, and you want to do different things to each window?

This should do that:

$win1 = "Info"
$win2 = "Complete"
$win1done = 0
$win2done = 0
While 1
   If WinExists($win1)  Then
     ;do something for the info window
      $win1done = 1
      if $win1done = 1 & $win2done = 1 then ExitLoop(2)
   ElseIf WinExists($win2) Then
     ;do something just for the complete window
      $win2done = 1
      if $win1done = 1 & $win2done = 1 then ExitLoop(2)
   EndIf
Wend

Or do you want to wait for either window to exist and then do the same thing no matter which window it is?

This should do that:

$win1 = "Info"
$win2 = "Complete"
While 1
   If WinExists($win1) Or WinExists($win2) Then
     ;do the same thing, no matter which window comes up first
      ExitLoop(2);to leave the while loop and continue with your script
   Else
      Sleep(250)
   EndIf
Wend

"I'm not even supposed to be here today!" -Dante (Hicks)

Posted

I use the same procedure as quoted by emmanuel.

<{POST_SNAPBACK}>

That's a nifty statement, I posted two codes...

Coffee or Tea?

Yes.

"I'm not even supposed to be here today!" -Dante (Hicks)

Posted

Tanks @ all - I will try to describe things more clearly.

The winner is:

While Not (WinExists("Win1") OR WinExists("Win2"))

WEnd

Grrrreat :ph34r:

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
  • Recently Browsing   0 members

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