Jump to content
Sign in to follow this  
JuggaloZeke

Quick IfThen Question

Recommended Posts

JuggaloZeke

The Problem: Sometimes the sript I wrote can run astray. I'm trying to solve this by making it check to see if it is at the correct place before it executes again. [it's in a while statement.]

Ok... I want an If Then statement that functions like this:

If [window is not active] Then
   Do this
Else
   Do this
EndIf

but I can't figure out how to make that first expression... an expression.

Edited by JuggaloZeke

Share this post


Link to post
Share on other sites
JuggaloZeke

Even something like

If [WinWaitActive exp[b][/b]ression] Then
   Do This
Else
   Do This
EndIf

Would work but I don't know how to get the WinWaitActive to work with If.

Share this post


Link to post
Share on other sites
SumTingWong

Even something like

If [WinWaitActive exp[b][/b]ression] Then
   Do This
Else
   Do This
EndIf

Would work but I don't know how to get the WinWaitActive to work with If.

<{POST_SNAPBACK}>

WinWaitActive returns 1 for success and 0 for failure

Therefore:

If WinWaitActive(....) = 1 Then
  ; do something with active window
Else
  ; window not found
EndIf

Check help file for more info on WinWaitActive.

Edited by pacman

Share this post


Link to post
Share on other sites
SlimShady

If NOT WinActive("Title", "optional text. you can leave this out") Then
 ;Do this
Else
 ;Do this
EndIf

Share this post


Link to post
Share on other sites
JuggaloZeke

Thanks pacman, I totally forgot that returned a value like that.

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  

×