Re: If NOT?
jvdzande <[email protected]>
| Newsgroups | gmane.comp.windows.autoit.user |
|---|---|
| Message-ID | <[email protected]> |
The "If Not"test should be done this way: If NOT ($NETCHECK = "Yes") Then The reason is that else you are testing: If (NOT $NETCHECK) = "Yes" Then Jos --- In [email protected], <marx.external@...> wrote: > > I am trying to do an if not against a string. I have never gotten this > to work correctly and have done cheap little work arounds but thought I > might see how to properly do this. Here is the scenario. > > > > I have a string value: $NETCHECK = "NO" > > > > Prior to performing a task I want to make sure this is NOT set to NO. > So I wrote a quickie test script like this: > > $NETCHECK = "No" > > If $NETCHECK NOT = "Yes" Then > > MsgBox(0,"test","Yes") > > Else > > MsgBox(0,"test","No") > > EndIf > > > > It does not respond properly. I have tried the following variations: > > If NOT $NETCHECK = "Yes" Then > > If NOT $NETCHECK "Yes" Then > > If $NETCHECK NOT "Yes" Then > > > > None of these return properly. In the past I would have just done this > > If $NETCHECK = "No" Then > > Else > > MsgBox(0,"test","No") > > EndIf > > > > I also considered doing this: > > If NOT STRINGINSTR($NETCHECK,"no") Then > > MsgBox(0,"test","No") > > EndIf > > > > I was just hoping for a cleaner/more efficient way of doing it. > > > > Thanks in advance. > > > > > > > > [Non-text portions of this message have been removed] >