Tach zusamm.
Mir war mal wieder etwas langweilig, also hab ich mal schnell das hier gecodet
Spoiler anzeigen
#include <Misc.au3>
#include <GUIConstantsEx.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Morsecode", 230, 380, -1, -1)
GUISetBkColor(0xC0DCC0)
$Label1 = GUICtrlCreateLabel("Bitte geben Sie hier den Text ein.", 4, 4, 219, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Edit1 = GUICtrlCreateEdit("", 4, 24, 221, 129)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("In Morsecode umwanden", 4, 156, 135, 25, 0)
$Button2 = GUICtrlCreateButton("Abspielen", 4, 352, 85, 25, 0)
$Label2 = GUICtrlCreateLabel("Hier steht der Morsecode", 4, 200, 162, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Edit2 = GUICtrlCreateEdit("", 4, 221, 221, 129)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$Read1 = GUICtrlRead ($Edit1)
_MorseCodeWrite ($Read1, $Edit2)
Case $Button2
$Read2 = GUICtrlRead ($Edit2)
_Beep ($Read2)
EndSwitch
WEnd
Func _MorseCodeWrite ($String, $Handle)
GUICtrlSetData ($Handle, "")
Local $Split = StringSplit ($String, "")
For $i = 1 To $Split[0] Step 1
If $Split[$i] = " " Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "| ")
ElseIf $Split[$i] = "A" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", ".- ")
ElseIf $Split[$i] = "B" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "-. ")
ElseIf $Split[$i] = "C" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "-.-. ")
ElseIf $Split[$i] = "D" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "-. ")
ElseIf $Split[$i] = "E" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", ". ")
ElseIf $Split[$i] = "F" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", ".-. ")
ElseIf $Split[$i] = "G" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "-. ")
ElseIf $Split[$i] = "H" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", ".... ")
ElseIf $Split[$i] = "I" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", ".. ")
ElseIf $Split[$i] = "J" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", ".--- ")
ElseIf $Split[$i] = "K" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "-.- ")
ElseIf $Split[$i] = "L" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", ".-.. ")
ElseIf $Split[$i] = "M" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "-- ")
ElseIf $Split[$i] = "N" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "-. ")
ElseIf $Split[$i] = "O" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "--- ")
ElseIf $Split[$i] = "P" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", ".--. ")
ElseIf $Split[$i] = "S" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "... ")
ElseIf $Split[$i] = "T" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "..- ")
ElseIf $Split[$i] = "U" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "..- ")
ElseIf $Split[$i] = "V" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "...- ")
ElseIf $Split[$i] = "W" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", ".-- ")
ElseIf $Split[$i] = "X" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "-..- ")
ElseIf $Split[$i] = "Y" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "-.-- ")
ElseIf $Split[$i] = "Z" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "--.. ")
ElseIf $Split[$i] = "0" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "----- ")
ElseIf $Split[$i] = "1" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", ".---- ")
ElseIf $Split[$i] = "2" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "..--- ")
ElseIf $Split[$i] = "3" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "...-- ")
ElseIf $Split[$i] = "4" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "....- ")
ElseIf $Split[$i] = "5" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "..... ")
ElseIf $Split[$i] = "6" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "-.... ")
ElseIf $Split[$i] = "7" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "--... ")
ElseIf $Split[$i] = "8" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "---.. ")
ElseIf $Split[$i] = "9" Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", "----. ")
ElseIf $Split[$i] = "." Then
ControlCommand ($Form1, "", $Edit2, "EditPaste", ".-.-.- ")
EndIf
Next
EndFunc ;==> _MorseCode
Func _Beep ($Code)
$Split = StringSplit ($Code, "")
For $i = 1 To $Split[0] Step 1
If $Split[$i] = "." Then
Beep (1000, 50)
Sleep (125)
ElseIf $Split[$i] = "-" Then
Beep (1000, 200)
Sleep (125)
ElseIf $Split[$i] = " " Then
Sleep (250)
ElseIf $Split[$i] = "|" Then
Beep (200, 200)
EndIf
Next
Sleep (350)
EndFunc ;==> _Beep
Einfach oben den Text eingeben, dann auf umwandeln und dann auf Abspielen.
Bin mir sicher, dass man den code noch stark kürzen kann, aber ich wüsste im moment nich genau wie ...