Sign in to follow this  
Followers 0
R33F

I am Noob Need Help please

3 posts in this topic

#1 ·  Posted (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", $:D

EndIf

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

Edited by R33F

Share this post


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


It's my job to comfort the disturbed and to disturb the comfortable.

Share this post


Link to post
Share on other sites

Thanks, mark !!!!!!!!!!!!! it works :D

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  
Followers 0