Jump to content

Problem with Checking if a window exists.


marscom
 Share

Recommended Posts

Hey all, basically I need my script to at any point while running, perform a specifc action if the window I am working with closes.

I cant actually post the code since the script contains some sensitive info, but I will provide a general structure of the functions

It looks like this

Func Start

$i = 0
While $i <> 1

If 'blah blah'

; Lots of if statments

Elseif

Function2()

Endif

Wend

EndFunc

Func Function2()

FuncA()
FuncB()
FuncC()
FuncD()

EndFunc

FuncA()
;Long complicated code
EndFunc

FuncB()
;Long complicated code
EndFunc

FuncC()
;Long complicated code
EndFunc

FuncD()
;Long complicated code
EndFunc

Anyways basically my problem is the window could disapear at any point, say for example while it is running FuncC() or while it is running Start() - I split my code up to make it easier to manage the long sections of code but this means if the window dissapears suddenly the script will not recognise it straight away unless I put an If WinExists($win_title,"")<>1 in front of every single section of code.

I just want to stick in a piece of code that will always moniter if the window exists and will notice at any point if it no longer exists, break any function running and run a seperate function.

How could I do this?

Sorry If I couldnt explain best but thanks in advance for any help!

Marscom

Edited by marscom
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...