bobheart Posted June 5, 2004 Share Posted June 5, 2004 Conditionally run statements. Related If...Then, If...Else...EndIf Example Select Case $var = 1 MsgBox(0, "", "First Case exp[b][/b]ression was true") Case $var2 = "test" MsgBox(0, "", "Second Case exp[b][/b]ression was true") Case Else MsgBox(0, "", "No preceding case was true!") EndSelect --------------------------- AutoIt Error --------------------------- Line 2 (File "E:\Programs\AutoIt3\Examples\june4\game_command4.au3"): Case $var = 1 Case ^ ERROR Error: Variable used without being declared. Link to comment Share on other sites More sharing options...
jpm Posted June 5, 2004 Share Posted June 5, 2004 Your select is OK if you set $var to somevalue before execution of the select. just add before $var= whatever the value should be Link to comment Share on other sites More sharing options...
bobheart Posted June 5, 2004 Author Share Posted June 5, 2004 Thats right out of the help file . I didn't make it or change it . Should it not run if it is an example ? Link to comment Share on other sites More sharing options...
jpm Posted June 6, 2004 Share Posted June 6, 2004 Thats right out of the help file . I didn't make it or change it . Should it not run if it is anĀ example ?All example in this section you are refering are to illustrate coding not to be run as is.Usually the ones in the Function reference run except doc error. Link to comment Share on other sites More sharing options...
cowsmanaut Posted June 6, 2004 Share Posted June 6, 2004 if you'd like to try something that would actually run based on that.. I did something here for you.. $var = InputBox("Computer Yesman", "do you like Apples?", "", "") Select Case $var = "no" MsgBox(0, "", "I don't like them either") Case $var = "yes" MsgBox(0, "", "Oh yeah.. aren't they awesome?") Case Else MsgBox(0, "", "make up your mind!") EndSelect it should illustrate how cases are being used. 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