Sign in to follow this  
Followers 0
SweatyOgre

If window exists, go on, else start program

5 posts in this topic

I would like to have my script start a program if it isnt already, but otherwise just continue. This is part of a function, so i cant just put the WinExists in an If statement and the rest of the script in an Else. Here's my code:

Func StartAim()
    Run($Path)
    WinWait($Aim, "", 20)
EndFunc

Is there a way to just tell it to only perform this operation if the window doesnt exist? Such as

Func StartAim()
    If WinExists($Aim) = 0 then
                Run($Path)
    WinWait($Aim, "", 20)
EndFunc

Share this post


Link to post
Share on other sites



Maybe like this?

Func StartAim()
   If WinExists($Aim) then
;Do nothing
   Else
    Run($Path)
    WinWait($Aim, "", 20)
    Endif
EndFunc

-Brett

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

So a line with nothing on it will make the script do nothing?

EDIT:To clarify, I mean a line following an If and preceding an Else.

Edited by SweatyOgre

Share this post


Link to post
Share on other sites

yep


-Brett

Share this post


Link to post
Share on other sites

thanks larry

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