Jump to content
Sign in to follow this  
TinyDwarf

If-Then-EndIf with Windows

Recommended Posts

TinyDwarf

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
Just_Plain_Cool

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.