Sign in to follow this  
Followers 0
MattX

IF IF IF IF IF - HELP !

5 posts in this topic

Silly question time can I have more than one If or do you have to use more Elses ?

I have a case of a prog starting but I may have 3 or 4 possible situations in regards to windows opening.....

Would it be:

If WinExists("Serif Registration Wizard") Then DO WHATEVER
Else WinWait("DrawPlus")
Else WinWait("DrawPlus new window")
Else WinWait("Another possible window")
DO WHATEVER
EndIf

Or

If WinExists("Serif Registration Wizard") Then DO WHATEVER
If WinWait("DrawPlus")
If WinWait("DrawPlus new window")
Else WinWait("Another possible window")
DO WHATEVER
EndIf
EndIf
EndIf

Sorry for the dumb question :idiot:

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Thanks Larry - is there a limit on the number of ElseIf commands you can use ?

If I was going to use say 10 of them then I suppose a Do Until would be better.

Did not know you can use 'Or' - time to change some badly written scripts.

Edited by MattX

Share this post


Link to post
Share on other sites

Logical operators are in the help file. :idiot:

AND, OR, NOT.... all usable with the "IF/Then Elseif/Then Else", "Do/Until", and "While/Wend".

ElseIf $lock = 05740 Or $lock = 05765 Or $lock = 05778 Or $lock = 05779 Or $lock = 12458 Or $lock = 12459 Then

This is my biggest ElseIf line with an "OR" so far. Currently building a massive script that will definately test the limits of the "ElseIf" if any exist. LOL. If $elseif > $limits.... I need to go back to work.

Personally, I think it should be infinate, as it basically is just an individual block of code that is only executed if the If/ElseIf is true. I treat If/ElseIf as a single line number in my head.....don't know if it helps, but.... have fun re-writing the code. Can't say that I envy you.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

But if you need more than a couple of If/ElseIf using a Select/Case/Case/EndSelect is better IMNSHO.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Logical operators are in the help file.  :idiot:

AND, OR, NOT.... all usable with the "IF/Then Elseif/Then Else", "Do/Until", and "While/Wend".

<{POST_SNAPBACK}>

Let me add to that:

Those operators even work in variables. (I only tried the NOT operatord, actually)

Let me give you some examples.

$var = NOT NOT 100 ;means: $var becomes 0 then turns into a 1

$var = NOT 100 ;means: $var equals 0

$var = NOT 0 ;means: $var equals 1

Edited by SlimShady

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