PartyPooper Posted November 12, 2005 Share Posted November 12, 2005 This has to be something I'm doing wrong, but for the life of me I can't see what. Are the operators I'm using to equate the Option 1, Option 2 and Option 3 values incorrect? The Help File has <> Test if two values are not equal. so I assume they are correct. Any help would be appreciated #include <GUIConstants.au3>Opt("GUIOnEventMode", 1)$MainGUI = GUICreate("MyGUI", 200, 100, -1, - 1)GUISetIcon(@SystemDir & "\pifmgr.dll", 27)GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit")$ComboBox = GUICtrlCreateCombo("",10, 25, 100, 30)GUICtrlSetData($ComboBox,"Option 1|Option 2|Option 3","Option 1")GUICtrlSetOnEvent(-1,"OnComboChoice")GUISetState(@SW_SHOW); GUI Message LoopWhile 1Sleep(200)WEndFunc OnComboChoice()$Choice = GUICtrlRead($ComboBox)If $Choice <> "Option 1" OR $Choice <> "Option 2" OR $Choice <> "Option 3" ThenMsgBox(262160,"ERROR", $Choice & " IS NOT equal to any test values")ElseMsgBox(262160,"ERROR", $Choice & " IS equal to a test value")EndIFEndFuncFunc OnExit()ExitEndFunc Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 12, 2005 Moderators Share Posted November 12, 2005 (edited) Try replacing <> with == that way, if they are "Not" equal, it would do your "Else" statement, and if they are equal, they would do the immediate "if" statement. The way you have it now, if it ever is "Not" equal, it would do your "Else" statement... <> is Less than or Greater than. Edit: As an example if you didn't want to change the entire code, you could do: If Not $Choice <> "Option 1" OR Not $Choice <> "Option 2" OR Not $Choice <> "Option 3" Then Edit 2: Gawd!!, I make things so complicated... you could just switch it out like Larry said below!! Edited November 12, 2005 by ronsrules Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
PartyPooper Posted November 12, 2005 Author Share Posted November 12, 2005 Now I just feel stupid. Why didn't I pick that up. Thanks Larry (and Ron for a good try ) Link to comment Share on other sites More sharing options...
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