thepip3r Posted April 19, 2008 Posted April 19, 2008 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
Developers Jos Posted April 19, 2008 Developers Posted April 19, 2008 (edited) Think about this line: If $os <> "WIN_2003" or $os <> "WIN_2000" or $os <> "WIN_XP" Then It need to be an AND relation: Edited April 19, 2008 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.
thepip3r Posted April 19, 2008 Author Posted April 19, 2008 i guess i can see how that would work (and it does in the code (ty Jos)) but why wouldn't "or" work?? My screwed up mind?? If $os is not equal to "WIN_2003" or $os is not equal to "WIN_2000" or $os is not equal to "WIN_XP" True, True, False nm... thnx again Jos. My Additions:- RunAs AdminDeviant Fun:- Variable Sound Volume
Developers Jos Posted April 20, 2008 Developers Posted April 20, 2008 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. 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now