Sign in to follow this  
Followers 0
marscom

Problem with Checking if a window exists.

3 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



Read about AdlibEnable()

Omg... I had no idea that even existed. You saved me god knows how many hours work...

Thankyou, seriously.

:)

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