Sign in to follow this  
Followers 0
Vindicator209

Spot a mistake...

2 posts in this topic

Helloes, I tried making an ASC to Binary convertor, but it gives me w whole lot of junk, and it only gives me the number of letters like:

tea : ABC

house : ABCDE

123456 : ABCDEF

and so on, heres my code, though im afraid its deathly long...

#include <GuiConstants.au3>

GuiCreate("Encoder", 670, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Edit_1 = GuiCtrlCreateEdit("Put Your Text In This Box", 10, 10, 300, 300)
$Button_2 = GuiCtrlCreateButton("Encode", 310, 120, 50, 30)
$Edit_3 = GuiCtrlCreateEdit("", 360, 10, 300, 300)
$line=""
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $Button_2
            $count=1
            Do
                $ASC=StringLeft(GUICtrlRead($Edit_1),$count)
                If $ASC = "a" or "A" Then
                    $line=$line&" "&FileReadLine("ASC.txt",1)
                EndIf
                If $ASC = "b" or "B" Then
                    $line=$line&" "&FileReadLine("ASC.txt",2)
                EndIf
                If $ASC = "c" or "C" Then
                    $line=$line&" "&FileReadLine("ASC.txt",3)
                EndIf
                If $ASC = "d" or "D" Then
                    $line=$line&" "&FileReadLine("ASC.txt",4)
                EndIf
                If $ASC = "e" or "E" Then
                    $line=$line&" "&FileReadLine("ASC.txt",5)
                EndIf
                If $ASC = "f" or "F" Then
                    $line=$line&" "&FileReadLine("ASC.txt",6)
                EndIf
                If $ASC = "g" or "G" Then
                    $line=$line&" "&FileReadLine("ASC.txt",7)
                EndIf
                If $ASC = "h" or "H" Then
                    $line=$line&" "&FileReadLine("ASC.txt",8)
                EndIf
                If $ASC = "i" or "I" Then
                    $line=$line&" "&FileReadLine("ASC.txt",9)
                EndIf
                If $ASC = "j" or "J" Then
                    $line=$line&" "&FileReadLine("ASC.txt",10)
                EndIf
                If $ASC = "k" or "K" Then
                    $line=$line&" "&FileReadLine("ASC.txt",11)
                EndIf
                If $ASC = "l" or "L" Then
                    $line=$line&" "&FileReadLine("ASC.txt",12)
                EndIf
                If $ASC = "m" or "M" Then
                    $line=$line&" "&FileReadLine("ASC.txt",13)
                EndIf
                If $ASC = "n" or "N" Then
                    $line=$line&" "&FileReadLine("ASC.txt",14)
                EndIf
                If $ASC = "o" or "O" Then
                    $line=$line&" "&FileReadLine("ASC.txt",15)
                EndIf
                If $ASC = "p" or "P" Then
                    $line=$line&" "&FileReadLine("ASC.txt",16)
                EndIf
                If $ASC = "q" or "Q" Then
                    $line=$line&" "&FileReadLine("ASC.txt",17)
                EndIf
                If $ASC = "r" or "R" Then
                    $line=$line&" "&FileReadLine("ASC.txt",18)
                EndIf
                If $ASC = "s" or "S" Then
                    $line=$line&" "&FileReadLine("ASC.txt",19)
                EndIf
                If $ASC = "t" or "T" Then
                    $line=$line&" "&FileReadLine("ASC.txt",20)
                EndIf
                If $ASC = "u" or "U" Then
                    $line=$line&" "&FileReadLine("ASC.txt",21)
                EndIf
                If $ASC = "v" or "V" Then
                    $line=$line&" "&FileReadLine("ASC.txt",22)
                EndIf
                If $ASC = "w" or "W" Then
                    $line=$line&" "&FileReadLine("ASC.txt",23)
                EndIf
                If $ASC = "x" or "X" Then
                    $line=$line&" "&FileReadLine("ASC.txt",24)
                EndIf
                If $ASC = "y" or "Y" Then
                    $line=$line&" "&FileReadLine("ASC.txt",25)
                EndIf
                If $ASC = "z" or "Z" Then
                    $line=$line&" "&FileReadLine("ASC.txt",26)
                EndIf
                If $ASC = "1" Then
                    $line=$line&" "&FileReadLine("NUM.txt",1)
                EndIf
                If $ASC = "2" Then
                    $line=$line&" "&FileReadLine("NUM.txt",2)
                EndIf
                If $ASC = "2" Then
                    $line=$line&" "&FileReadLine("NUM.txt",3)
                EndIf
                If $ASC = "4" Then
                    $line=$line&" "&FileReadLine("NUM.txt",4)
                EndIf
                If $ASC = "5" Then
                    $line=$line&" "&FileReadLine("NUM.txt",5)
                EndIf
                If $ASC = "6" Then
                    $line=$line&" "&FileReadLine("NUM.txt",6)
                EndIf
                If $ASC = "7" Then
                    $line=$line&" "&FileReadLine("NUM.txt",7)
                EndIf
                If $ASC = "8" Then
                    $line=$line&" "&FileReadLine("NUM.txt",8)
                EndIf
                If $ASC = "9" Then
                    $line=$line&" "&FileReadLine("NUM.txt",9)
                EndIf
                If $ASC = "0" Then
                    $line=$line&" "&FileReadLine("NUM.txt",10)
                EndIf
                If $ASC = " " Then
                    $line=$line&" "&FileReadLine("NUM.txt",11)
                EndIf
GuiCtrlSetData($Edit_3,$line)
                $count=$count+1
            Until $count = StringLen(GUICtrlRead($Edit_1))
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit

Thank you


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

the general error is your IF-Syntax. Try this one instead:

If ($ASC = "a") Or ($ASC = "A") ThenoÝ÷ Ø    ÝêÞßÛ&ÉÊ&¦W­z·°¢¹ºÚ"µÍÚ[ÛYH  ÑÝZPÛÛÝ[Ë]LÉÝÂÕRPÜX]J    ][ÝÑ[ÛÙ][ÝË
ÌÌMLKLK]Ô    ÌÍÕÔ×ÓÕTTQÒSÕË    ÌÍÕÔ×ÐÓTÒPSÔÊJBÌÍÑY]ÌHHÕRPÝÜX]QY]
    ][ÝÔ][Ý^[ÈÞ    ][ÝËLLÌÌ
BÌÍÐ]ÛÌHÕRPÝÜX]P]Û ][ÝÑ[ÛÙI][ÝËÌLL
LÌ
BÌÍÑY]ÌÈHÕRPÝÜX]QY]
    ][ÝÉ][ÝËÍLÌÌ
BÌÍÛ[HH  ][ÝÉ][ÝÂÕRTÙ]Ý]J
BÚ[HBIÌÍÛÙÈHÕRQÙ]ÙÊ
BTÙ[XÝBPØÙH ÌÍÛÙÈH ÌÍÐ]ÛÌBBIÌÍØÛÝ[HBBQÂBBBIÌÍÐTÐÈHÝ[ÓZY
ÕRPÝXY
    ÌÍÑY]ÌJK    ÌÍØÛÝ[
ÌKJBBBBBBBBIÌÍØÛÙHHØÊ   ÌÍÐTÐÊBBBBRY
    ÌÍØÛÙH ÝÏHMÊH[
    ÌÍØÛÙIÏLLH[BBBBIÌÍÛ[WÛH   ÌÍØÛÙHHMBBBQ[ÙRY
    ÌÍØÛÙH ÝÏH
JH[
    ÌÍØÛÙH ÏHL
H[BBBBIÌÍÛ[WÛH  ÌÍØÛÙHH
BBBQ[ÙRY
    ÌÍØÛÙH ÝÏH

H[
    ÌÍØÛÙH ÏH
MÊH[BBBBIÌÍÛ[WÛH   ÌÍØÛÙHH

ÂBBBQ[Y    ÌÍÛ[HH   ÌÍÛ[H    [È ][ÝÈ  ][ÝÈ  [È[TXY[J   ][ÝÐTÐË ][ÝË  ÌÍÛ[WÛBBBBQÕRPÝÙ]]J  ÌÍÑY]ÌË    ÌÍÛ[JBBBBIÌÍØÛÝ[H   ÌÍØÛÝ[
ÈBBBU[[    ÌÍØÛÝ[ ÝÏHÝ[Ó[ÕRPÝXY
    ÌÍÑY]ÌJJBBPØÙH    ÌÍÛÙÈH ÌÍÑÕRWÑUSÐÓÔÑBBBQ^]ÛÜBPØÙH[ÙBBBNÎÎÂQ[Ù[XÝÑ[^]oÝ÷ Ù(§qâºyèÊ« ­Æ×âèʬje˧¶Ú¢{Þ®Ö¥ÈZ®Ëhn)Ú¯(hÁ¦èºÖ®¶­sb6æ6ÇVFRfÇC´wV6öç7FçG2æS2fwC° ¤uT7&VFRgV÷C´Væ6öFW"gV÷C²ÂcsÂ3bÂÓÂÓÂ&"b33cµu5ôõdU$ÄTEtäDõrÂb33cµu5ô4Ä4$Ääu2 ¢b33c´VFEóÒuT7G&Ä7&VFTVFBgV÷CµWB÷W"FWBâF2&÷gV÷C²ÂÂÂ3Â3¢b33c´'WGFöåó"ÒuT7G&Ä7&VFT'WGFöâgV÷C´Væ6öFRgV÷C²Â3Â#ÂSÂ3¢b33c´VFEó2ÒuT7G&Ä7&VFTVFBgV÷C²gV÷C²Â3cÂÂ3Â3¢b33c¶ÆæRÒgV÷C²gV÷C°¤uT6WE7FFR¥vÆR b33c¶×6rÒuTvWD×6r 6VÆV7@ 66Rb33c¶×6rÒb33c´'WGFöåó  b33c¶6÷VçBÒ Fð b33c´42Ò7G&ætÖBuT7G&Å&VBb33c´VFEóÂb33c¶6÷VçB²Â  b33c¶6öFRÒ62b33c´42 b33c·CÒgV÷C²gV÷C° f÷"b33c¶ÒFò b33c·CÒÖöBb33c¶6öFRÂ"fײb33c·C b33c¶6öFRÒfÆö÷"b33c¶6öFRò" æW@  b33c¶ÆæRÒb33c¶ÆæRfײgV÷C²gV÷C²fײb33c·C   uT7G&Å6WDFFb33c´VFEó2Âb33c¶ÆæR b33c¶6÷VçBÒb33c¶6÷VçB² VçFÂb33c¶6÷VçBfwC³Ò7G&ætÆVâuT7G&Å&VBb33c´VFEó 66Rb33c¶×6rÒb33c´uTôUdTåEô4Äõ4P WDÆö÷ 66RVÇ6P ³³° VæE6VÆV7@¥tVæ@¤W

AscToBin conversion shamelessly stolen from nfwu here :whistle:

have fun,

Marc

Edited by Marc

It's my job to comfort the disturbed and to disturb the comfortable.
My Projects: Profiler, MakeSFX, UserInfo

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