Jump to content

Wierd Issue... @OSVersion resolves fine -- conditional not?


Recommended Posts

Func __checkOSVersion()
    Local $os = @OSVersion
    If $os <> "WIN_2003" or $os <> "WIN_2000" or $os <> "WIN_XP" Then
        MsgBox(0, "Operating System Incompatability (" & $os & ")", "Only Windows 2000, XP, and 2003 are supported right now.")
        Exit
    EndIf
EndFunc

@OSVersion reports as "WIN_XP" on my system but since I wrote this function and started using it, its' stopping me from accessing my program again. While I know I can comment it out until I figure out what's wrong, is there something glaringly obvious that's wrong with my logic as to why it IS in fact evaluating to true when it shouldn't be?? TIA.

My Additions:- RunAs AdminDeviant Fun:- Variable Sound Volume

Link to comment
Share on other sites

  • Developers

Think about this line:

If $os <> "WIN_2003" or $os <> "WIN_2000" or $os <> "WIN_XP" Then

It need to be an AND relation:

:D

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

It is simple when you see it: Whatever OS you have a minimum of 2 out of the 3 conditions is always TRUE thus the If is always true since you use an OR.

It helps when you read the statement out loud.

:D

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...