Jump to content

if not


 Share

Recommended Posts

what am i doing wrong here? $split is not SKE or 201TL or 67GA or SPEEKS so it should give me the msgbox right?

[/code]
        $split ="t"
        
    If not $split = "SKE" _
        or not $split ="201TL" _
        or not $split ="67GA" _
        or not $split ="SPEEKS"Then
        
        MsgBox(262192, "Warning", $split&" is an unknown code")
;ContinueLoop
    EndIf
[code]

TY

Link to comment
Share on other sites

$split = "t"

If Not $split <> "SKE" _
        Or $split <> "201TL" _
        Or $split <> "67GA" _
        Or $split <> "SPEEKS" Then
    MsgBox(0, "Warning", $split & " is an unknown code")
    ;ContinueLoop
EndIf

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

$split = "t"

If Not $split <> "SKE" _
        Or $split <> "201TL" _
        Or $split <> "67GA" _
        Or $split <> "SPEEKS" Then
    MsgBox(0, "Warning", $split & " is an unknown code")
    ;ContinueLoop
EndIf
That doesn't seem right. Cause when $split = "SKE" then it still gives the msgbox....

Any idea's anyone?

thnx

Link to comment
Share on other sites

That's what I get for going over the code too quickly - try this:

$split = "t"

If $split <> "SKE" _
        And $split <> "201TL" _
        And $split <> "67GA" _
        And $split <> "SPEEKS" Then
    MsgBox(0, "Warning", $split & " is an unknown code")
    ;ContinueLoop
EndIf

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

That's what I get for going over the code too quickly - try this:

$split = "t"

If $split <> "SKE" _
        And $split <> "201TL" _
        And $split <> "67GA" _
        And $split <> "SPEEKS" Then
    MsgBox(0, "Warning", $split & " is an unknown code")
    ;ContinueLoop
EndIf
TY, that worked! while waiting i also found this solution:

[/code]
$split = "t"

If $split = "SKELET" _
Or $split = "201TL" _
Or $split = "67GA" _
Or $split = "SPEEKS" Then
    MsgBox(0, "Warning", $split & " is an known code")
    $split = $split
else 
    MsgBox(0, "Warning", $split & " is an unknown code")
   ;ContinueLoop
EndIf
[code]
Link to comment
Share on other sites

TY, that worked! while waiting i also found this solution:

[/code]
$split = "t"

If $split = "SKELET" _
Or $split = "201TL" _
Or $split = "67GA" _
Or $split = "SPEEKS" Then
    MsgBox(0, "Warning", $split & " is an known code")
    $split = $split
else 
    MsgBox(0, "Warning", $split & " is an unknown code")
  ;ContinueLoop
EndIf
[code]
Your code tags are switched, the forward slash goes on the last code tag.
Link to comment
Share on other sites

what am i doing wrong here? $split is not SKE or 201TL or 67GA or SPEEKS so it should give me the msgbox right?

$split ="t"
        
    If not $split = "SKE" _
        or not $split ="201TL" _
        or not $split ="67GA" _
        or not $split ="SPEEKS"Then
        
        MsgBox(262192, "Warning", $split&" is an unknown code")
;ContinueLoop
    EndIf
You've already got your work-around, but it is important to see why the original didn't work:

Look in the help file under "Operators", and the section below the table that give the "Operator Precedence":

When more than one operator is used in an expression the order in which things happen is controlled by operator precedence. The precedence used in AutoIt is given below. Where two operators have the same precedence the expression is evaluated left to right.

From highest precedence to lowest:

NOT

^

* /

+ -

&

< > <= >= = <> ==

AND OR

Notice that NOT has the highest precedence of all, and therefore gets checked FIRST.

So the first part of your If condition becomes:

; If not $split = "SKE"
If (not $split) = ("SKE")oÝ÷ Ù:,yèhÂËkx,mèZ½è§n%y©Ü¢wb¶*'²»§¶¬jëh×6$x = ""
ConsoleWrite("Debug: $x = " & $x & ";  Not $x = " & Not $x & @LF)
$x = "xyz"
ConsoleWrite("Debug: $x = " & $x & ";  Not $x = " & Not $x & @LF)oÝ÷ Ù(¦¦®²)භö[`·h¥êÚ¶àzÛ2¢ëa{M¢oÝ÷ Ù8^½©nzôß«)+b±Ç«µ¨§¶è¶f­r­æ¬·z.¶íî¢wb¶*'²Ê-âÂ)ejÊÆÞ¶»J¨º«ªlʦy©íjëh×6If $split <> "SKE" And $split <> "201TL" And $split <> "67GA" And $split <> "SPEEKS" Then

; Or, another way to put it...

If Not ($split = "SKE" Or $split = "201TL" Or $split = "67GA" Or $split = "SPEEKS") Then

:)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...