Jump to content

Can you use If's on Windows creations?


Falling
 Share

Recommended Posts

$wait= WinWait("title","", 5); 5 secs.
If $wait=1 Then...

This is what i was trying to do. Just seems so weird not having it in a function.

This is how i'd assume I'd check two windows.

Func WhichWindow($name1, $name2); 

  $window1 = WinWait($name1,"", 5); 5 secs. 
  $window2 = WinWait($name2,"", 5); 5 secs.

  If $window1 == $window2 Then
     Return 0;  None are true.
  EndIf

  If $window1 = 1
    Return 1;  $name1 is true

  Else
    Return 2;  $name2 is true
  EndIf

EndFunc

; example -> $whatnext = WhichWindow("Bank1menu", "Bank2menu")
; then u can use a switch case on what is next... etc.
Link to comment
Share on other sites

This is what I do

While 1
   If WinActive("Title", "Text") Then
      Do Something
      ExitLoop
  ElseIf WinActive("Title2","Text2") Then
      Do Something Else
      ExitLoop
   EndIf
   Sleep(250)
Wend

or

While 1
   If WinActive("Title", "Text") Then
      Do Something
      ExitLoop
   EndIf
   If WinActive("Title2","Text2") Then
      Do Something Else
      ExitLoop
   EndIf
   Sleep(250)
Wend
Edited by w_sp8er
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...