Buchstaben in ASCII umwandeln

  • Hi ho :
    also ich will ma ein Generator bauen der den Name in eine Asci nummer serlegt , also input1 = dein Name
    input2 = deine nummer
    sodas man den namen in eine nummer umwandeln kann und umgekert :D
    habs mir so gedacht :

    Spoiler anzeigen
    [autoit]


    #include

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 162, 108, 193, 125)
    $Button1 = GUICtrlCreateButton("Erzeugen", 45, 75, 75, 25, 0)
    $Input1 = GUICtrlCreateInput("Dein Namen :", 8, 8, 145, 21)
    $Input2 = GUICtrlCreateInput("In Asci :", 8, 40, 145, 21)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit]


    meine Probleme sind :
    1: ich hab kein Plan wie ich das realiesieren kann :thumbdown: also habt ihr vorschläge ?
    die asci zahlen und nummer hab ich in eine ini siht so aus :

    Spoiler anzeigen

    Einmal editiert, zuletzt von FunH@cker (3. Juni 2009 um 09:39)

  • Hi ho
    bis jetz zeigt er nur den 1rst buchstaben/Zahl an und sendet in als Asci :|
    aber wie soll ich es hin bekommen das er den Ganzen Namen in Asci anzeigt am besten (um es besser lesen zu können so) :
    name
    110-97-109-101
    mein skript sieht grad so aus :

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 162, 108, 193, 125)
    $Button1 = GUICtrlCreateButton("Erzeugen", 45, 75, 75, 25, 0)
    $Input1 = GUICtrlCreateInput("Dein Namen :", 8, 8, 145, 21)
    $Input2 = GUICtrlCreateInput("text", 8, 40, 145, 21)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    case $Button1
    $read = GUiCtrlRead($Input1)
    $ad = Asc($read)
    GUICtrlSetData($Input2,$ad)
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit]


    ich weis muss noch viel gemacht werden :D

    • Offizieller Beitrag

    Mit StringToASCIIArray bekommst Du ein Array mit den ASCII-Werten der Buchstaben.
    Beispiel:

    Spoiler anzeigen
    [autoit]


    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 162, 108, 193, 125)
    $Button1 = GUICtrlCreateButton("Erzeugen", 45, 75, 75, 25, 0)
    $Input1 = GUICtrlCreateInput("Dein Name:", 8, 8, 145, 21)
    $Input2 = GUICtrlCreateInput("", 8, 40, 145, 21)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    $aRead = StringToASCIIArray(GUICtrlRead($Input1))
    For $i = 0 To UBound($aRead) - 1
    GUICtrlSetData($Input2, Chr($aRead[$i]), 1)
    Sleep(200)
    Next
    EndSwitch
    WEnd

    [/autoit]
  • Aus irgendeinem Grund gibt es bei mir die Funktion StringToASCIIArray nicht.
    In der Hilfe steht sie beschrieben, in Scite ist ist unbekannt und wird als undefined function wiedergegeben.
    Wahrscheinlich eine zu alte AutoIT Version.

    Hier auch das Script ohne StringToASCIIArray + deine Trennung " - "

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #Include <string.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Local $ad

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 162, 108, 193, 125)
    $Button1 = GUICtrlCreateButton("Erzeugen", 45, 75, 75, 25, 0)
    $Input1 = GUICtrlCreateInput("Dein Namen :", 8, 8, 145, 21)
    $Input2 = GUICtrlCreateInput("text", 8, 40, 145, 21)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    case $Button1
    GUICtrlSetData($Input2, "")
    $read = StringSplit(GUiCtrlRead($Input1), "")
    For $i = 1 To $read[0]
    $ad = $ad&Asc($read[$i])&" - "
    Next
    $ad = StringTrimRight($ad, 3)
    GUICtrlSetData($Input2,$ad)
    $ad = ""
    EndSwitch
    WEnd

    [/autoit]

    Einmal editiert, zuletzt von seTTs (2. Juni 2009 um 16:31)

  • was ist eigenlich hir falsch , in der Hilfe funzt es ja auch ?( ;(

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <string.au3>
    #include <Array.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Local $ad

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 162, 108, 193, 125)
    $Button1 = GUICtrlCreateButton("Txt in Asci", 25, 75, 57, 25, 0)
    $Button2 = GUICtrlCreateButton("Asci in Txt", 85, 75, 57, 25, 0)
    $Input1 = GUICtrlCreateInput("Dein Namen :", 8, 8, 145, 21)
    $Input2 = GUICtrlCreateInput("text", 8, 40, 145, 21)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    GUICtrlSetData($Input2, "")
    $read = StringSplit(GUICtrlRead($Input1), "")
    For $i = 1 To $read[0]
    $ad = String($ad) & Asc($read[$i]) & " - "
    Next
    $ad = StringTrimRight(String($ad), 3)
    GUICtrlSetData($Input2, $ad)
    $ad = ""
    ;---------------------------------------------------------------------------------
    ;------------------------------------------------------------------------------
    case $Button2
       
    Local $s = StringFromASCIIArray(GUICtrlRead($Input2),0) ;Fehler !?
    GUICtrlSetData($Input1, $s)
    $s = ""
    ;-----------------------------------------------------------------------------
    ;----------------------------------------------------------------------------------
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit]
  • Ich habe Dein Script jetzt nicht getestet, aber die Funktion heißt "StringFromASCIIArray()" !

    Als Eingabe nutzt Du aber GUICtrlRead(), welche einen String zurückgibt und kein ARRAY.

    Zur Nutzung dieses Forum's, ist ein Übersetzer für folgende Begriffe unerlässlich:

    "On-Bort, weier, verscheiden, schädliges, Butten steyling, näckstet, Parr, Porblem, scripe, Kompletenz, harken, manuel zu extramieren, geckukt, würglich, excell, acces oder Compilevorgeng"

  • es gibt ja _ArrayToString geht das auch anders rum oder gibt es eine andere möglichkeit mein problem zu lösen ?

  • habs jetz mit Stringsplit versucht jetz kommt zumindest ein zeichen leider fehlt da wohl was das das in normalen Bichstaben/Zahlen umwandelt ich weis aber nicht was :thumbdown: oder hab ich da was fasch gemacht ?

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <string.au3>
    #include <Array.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Local $ad

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 162, 108, 193, 125)
    $Button1 = GUICtrlCreateButton("Txt in Asci", 25, 75, 57, 25, 0)
    $Button2 = GUICtrlCreateButton("Asci in Txt", 85, 75, 57, 25, 0)
    $Input1 = GUICtrlCreateInput("Dein Namen :", 8, 8, 145, 21)
    $Input2 = GUICtrlCreateInput("text", 8, 40, 145, 21)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    GUICtrlSetData($Input2, "")
    $read = StringSplit(GUICtrlRead($Input1), "")
    For $i = 1 To $read[0]
    $ad = String($ad) & Asc($read[$i]) & " - "
    Next
    $ad = StringTrimRight(String($ad), 3)
    GUICtrlSetData($Input2, $ad)
    $ad = ""

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    case $Button2
       
    $Split = StringSplit(GUICtrlRead($Input2),0)
       
    Local $s = StringFromASCIIArray($Split)
    GUICtrlSetData($Input1,($s),0)
    $s = ""

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit]
  • So geht's:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <string.au3>
    #include <Array.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $ad ; "Lokal" gibt es nur in Funktionen

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 162, 108, 193, 125)
    $Button1 = GUICtrlCreateButton("Txt in Asci", 25, 75, 57, 25, 0)
    $Button2 = GUICtrlCreateButton("Asci in Txt", 85, 75, 57, 25, 0)
    $Input1 = GUICtrlCreateInput("Dein Namen :", 8, 8, 145, 21)
    $Input2 = GUICtrlCreateInput("text", 8, 40, 145, 21)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    Case $Button1
    ;GUICtrlSetData($Input2, "") ; unnötig wird sowieso gleich gefüllt
    $read = StringSplit(GUICtrlRead($Input1), "")
    For $i = 1 To $read[0]
    $ad &= Asc($read[$i]) & " - "
    Next
    $ad = StringTrimRight(String($ad), 3)
    GUICtrlSetData($Input2, $ad)
    $ad = ""

    [/autoit] [autoit][/autoit] [autoit]

    Case $Button2
    $Split = StringSplit(GUICtrlRead($Input2)," - ",1) ; Trennen muss am kompletten Zeichen " - " erfolgen
    $s = StringFromASCIIArray($Split,1) ; Array muss nach StringSplit bei 1 starten
    GUICtrlSetData($Input1,$s)
    $s = ""

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit]

    Zur Nutzung dieses Forum's, ist ein Übersetzer für folgende Begriffe unerlässlich:

    "On-Bort, weier, verscheiden, schädliges, Butten steyling, näckstet, Parr, Porblem, scripe, Kompletenz, harken, manuel zu extramieren, geckukt, würglich, excell, acces oder Compilevorgeng"