Jump to content

I am Noob Need Help please


R33F
 Share

Recommended Posts

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", $:D

EndIf

******************************************************************************

Edited by R33F
Link to comment
Share on other sites

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...