Jump to content

If Window Exists...


Recommended Posts

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?

Link to comment
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
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...