R33F Posted March 26, 2009 Share Posted March 26, 2009 (edited) I need help on the following topic.I am a newbie in autoit.: Prompt the user to enter their name. If the first letter of their first name is between A and M, then display a dialog box that says You are in the first group, if the first letter of their first name is between N and Z, then display a dialog box that says You are in the second group. I just need to know how to go about it.$a i need to put the letters from a to m and in $b i need to put the letters from n to z ************************************************************** I have reached so far: #include <string.au3> ;Places the input box in the top left corner displaying the characters as they ;are typed. $i = InputBox("Question", "Please Enter your Name?" ) $a= StringCompare("A", "B", "C", "D") $b= StringCompare("E") If &i = $a Then MsgBox(0, "You Belong to the First Group", $a ) ElseIf &i = $b Then MsgBox(0, "You Belong to the second group", $ EndIf ****************************************************************************** Edited March 26, 2009 by R33F Link to comment Share on other sites More sharing options...
Marc Posted March 26, 2009 Share Posted March 26, 2009 Hi, I'd suggest to get the first character of the name and compare it to the boundaries: #include <string.au3> ;Places the input box in the top left corner displaying the characters as they ;are typed. $i = InputBox("Question", "Please Enter your Name?") $firstchar = StringUpper(StringLeft($i, 1)) ; copy the first character of the name and make it uppercase If ($firstchar >= "A") And ($firstchar <= "M") Then MsgBox(0, "You Belong to the First Group", "A-M") Else MsgBox(0, "You Belong to the second group", "N-Z") EndIf Hope this helps, Marc Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL) Link to comment Share on other sites More sharing options...
R33F Posted March 26, 2009 Author Share Posted March 26, 2009 Thanks, mark !!!!!!!!!!!!! it works 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