Sign in to follow this  
Followers 0
Hello Me You

noob winwaitactive failure

4 posts in this topic

This is a very basic question, I am sorry, i couldnt find a good example to figure it out for myself. ;)

given the code:

WinWaitActive("Untitled - Notepad","", 2)

I know it tries to activate notepad for 2 seconds. But how do I tell it if successful do this or if it fails then do that?

Thanks, and sorry for the stupid question.


Random

Share this post


Link to post
Share on other sites



It doesn't try to activate a window, it just waits for the window to become active.

So, if you actually want to activate a window then you should try WinActivate instead.

Also, to see if something was successful or not, then always look at what's mentioned

under "Return Value" in the helpfile.

Share this post


Link to post
Share on other sites

Check the return value:

Return Value

Success: Returns 1.

Failure: Returns 0 if timeout occurred.

$x = WinWaitActive("Untitled - Notepad","", 2)
if $x = 1 then 
   ;do this
else
   ;do that
endif

Share this post


Link to post
Share on other sites

Thank you, that was exactly what I needed. (and much quicker than I would have guessed) ;)


Random

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