Jump to content
Sign in to follow this  

Why won't this work?

Recommended Posts


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. B) Any help would be appreciated

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

$MainGUI = GUICreate("MyGUI", 200, 100, -1, - 1)

GUISetIcon(@SystemDir & "\pifmgr.dll", 27)


$ComboBox = GUICtrlCreateCombo("",10, 25, 100, 30)

GUICtrlSetData($ComboBox,"Option 1|Option 2|Option 3","Option 1")



; GUI Message Loop

While 1



Func OnComboChoice()

$Choice = GUICtrlRead($ComboBox)

If $Choice <> "Option 1" OR $Choice <> "Option 2" OR $Choice <> "Option 3" Then

MsgBox(262160,"ERROR", $Choice & " IS NOT equal to any test values")


MsgBox(262160,"ERROR", $Choice & " IS equal to a test value")



Func OnExit()



Share this post

Link to post
Share on other sites

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.


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

Share this post

Link to post
Share on other sites

Now I just feel stupid. Why didn't I pick that up.

Thanks Larry (and Ron for a good try B))

Share this post

Link to post
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

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.