Sign in to follow this  
Followers 0
TinyDwarf

If-Then-EndIf with Windows

2 posts in this topic

Hello

I would Like check if one windows is open or one other...

The script can be like that but I know it's not right:

If WinWaitActive("Windows_Title1", "Windows_Text1") Then MsgBox(0, "", "Windows2")

ElseIf WinWaitActive("Windows_Title2", "Windows_Text2") Then MsgBox(0, "", "Windows2")

EndIf

Thk you for you help.

Share this post


Link to post
Share on other sites



Hello

I would Like check if one windows is open or one other...

The script can be like that but I know it's not right:

If WinWaitActive("Windows_Title1", "Windows_Text1") Then MsgBox(0, "", "Windows2")

ElseIf WinWaitActive("Windows_Title2", "Windows_Text2") Then MsgBox(0, "", "Windows2")

EndIf

Thk you for you help.

Try the code below. I used WinActive() to match up with what you were attempting before. If you only want to know if it exists and it doesn't need to be active then use WinExists().

While 1
    If WinActive("Windows_Title1", "Windows_Text1") Then;if your first window is open and active then pop up MsgBox and leave the loop
        MsgBox(0, "", "Windows1")
        ExitLoop
    ElseIf WinActive("Windows_Title2", "Windows_Text2") Then;if your second window is open and active then pop up MsgBox and leave the loop
        MsgBox(0, "", "Windows2")
        ExitLoop
    EndIf
    Sleep(10);keep this loop from being a system hog
WEnd

Hope this helps,

JPC B)

Share this post


Link to post
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
Sign in to follow this  
Followers 0