Jump to content

If window is not active then exit


Tulos
 Share

Recommended Posts

Would or should this work?

//////////

WinWait("Program Name","")

If Not WinActive("Program Name","") Then WinActivate("Program Name","")

WinWaitActive("Program Name","")

Sleep (5000)

If Not WinActive("Program Name","") Then Exit

/////////

I ask because sometimes the program the script is to run in closes but the script continues to run and thus creates a mess on my desktop lol

Thanks

Huserx

Link to comment
Share on other sites

. . . sometimes the program the script is to run in closes but the script continues to run and thus creates a mess on my desktop . . .

Try something like the below example. Also search the Help file for WinWait() and WinExists() for more information.

WinWait("Program Name", "", 3)
If WinExists("Program Name", "") Then
    If Not WinActive("Program Name", "") Then WinActivate("Program Name", "")
    WinWaitActive("Program Name", "")
    Sleep(5000)
Else
    Exit
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...