Newbie2 Posted February 10, 2004 Share Posted February 10, 2004 Hey, I was wondering if there is a way to map the alphabetical letters into an array. Can I "increment" a Letter in order to put it in a loop for the array? Example: A = 41 B = 42 . . . . J=49 etc... Link to comment Share on other sites More sharing options...
trids Posted February 10, 2004 Share Posted February 10, 2004 Hex(Asc("A"),4) = "0041" Asc("A") = 65 Chr(65) = "A" .. so you could loop from 65, incrementing by one, and to get the character equivalent, you pass it to Chr(): for $nX = Asc("A") to Asc("J") Msgbox(0,$nX, Chr($nX)) Next If you desparately want to use an array .. ;Load the array $aLetter = StringSplit("A,B,C,D,E,F,G,H,I,J", ",") ;Read from the array Msgbox(0,"","C is = " & $aLetter[3]) Is any of this what you mean? Link to comment Share on other sites More sharing options...
Newbie2 Posted February 10, 2004 Author Share Posted February 10, 2004 (edited) 10x. It's almost it. I want to map all the followings. 0041=A 0042=B 0043=C 0044=D 0045=E 0046=F 0047=G 0048=H 0049=I 004A=J 004B=K 004C=L 004D=M 004E=N 004F=O 0050=P 0051=Q 0052=R 0053=S 0054=T 0055=U 0056=V 0057=W 0058=X 0059=Y 005A=Z Edited February 10, 2004 by Newbie2 Link to comment Share on other sites More sharing options...
Administrators Jon Posted February 10, 2004 Administrators Share Posted February 10, 2004 $var = 41 $result = Chr(($var - 41) + 65 ) MsgBox(0, "$var maps to the letter", $result) Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
trids Posted February 10, 2004 Share Posted February 10, 2004 Be careful: 0041 is the hex for 65. And is expressed as a string in au3. So .. "A" = Chr(Dec("0041")) Or .. "0041" = Hex(Asc("A"),4) ;4 = length of resulting string Can you give an example of how you want to use the mapping you refer to? Link to comment Share on other sites More sharing options...
Newbie2 Posted February 10, 2004 Author Share Posted February 10, 2004 10x Jon / Trids All I wanna do is when the user enter's an alphabetical letter in an InputBox, a result will be desplayed in a msgbox according to the following pattern: For example: If the input letter is: "M", the result should be "004D" Mapping pattern: 0041=A 0042=B 0043=C 0044=D 0045=E 0046=F 0047=G 0048=H 0049=I 004A=J 004B=K 004C=L 004D=M 004E=N 004F=O 0050=P 0051=Q 0052=R 0053=S 0054=T 0055=U 0056=V 0057=W 0058=X 0059=Y 005A=Z Link to comment Share on other sites More sharing options...
Administrators Jon Posted February 10, 2004 Administrators Share Posted February 10, 2004 $input = InputBox("Input", "Enter a letter") $input = StringLeft(StringUpper($input), 1) $result = "00" & Hex(Asc($input), 2) MsgBox(0, "Result", $result) It will make sure the input only uses the first letter and also makes sure it is a capital. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Newbie2 Posted February 10, 2004 Author Share Posted February 10, 2004 (edited) Jon / Larry, I Like You In a Way That is Appropriate! EDIT: This post has been moderated Edited February 10, 2004 by Larry 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