Sign in to follow this  
Followers 0
RyGoTypE

If Window Exists...

2 posts in this topic

Hey, I need help here.

I am trying to check and see if a certain window exists, if not, run the program so that the window will existif it does, continue with checking if the window is active. Then I want to check if the window is active, if it is, keep running the script. If it isnt, activate the window.

Any ideas?

Share this post


Link to post
Share on other sites



Nevermind, I figured it out.

; Check if window exists.
    If NOT WinExists ("DarkWars", "") Then
    ; BROWSER CHECK: If user doesn't have FireFox, use Internet Explorer.
        If FileExists(@ProgramFilesDir & "\Mozilla Firefox\firefox.exe") Then
            Run(@ProgramFilesDir & "\Mozilla Firefox\firefox.exe " & $URL )
        ElseIf FileExists(@ProgramFilesDir & "\Internet Explorer\iexplore.exe") Then
            Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe " & $URL )
        EndIf
    ElseIf WinExists ("DarkWars", "") Then
    ; Check if window is active.
        If Not WinActive("DarkWars") Then
            WinSetState("DarkWars", "", @SW_SHOW)
        Endif
    ; Continue on with script.
    ; Continue on with script.
    ; Continue on with script.
    ; Continue on with script.
    EndIf
1 person likes this

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