#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=PngTexturen22\SionSLoGo.ico
#AutoIt3Wrapper_Res_Comment=By SionS
#AutoIt3Wrapper_Res_Description=Kennwort Gennerator
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("SionS PasswortGen", 318, 154, 548, 312)
GUISetIcon("C:\Users\Tobias\Desktop\PngTexturen22\SionSLoGo.ico")
GUISetBkColor(0x000000)
$Label1 = GUICtrlCreateLabel("Drücken Sie auf GenStart.", 15, 15, 301, 23)
GUICtrlSetFont(-1, 12, 800, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$Button1 = GUICtrlCreateButton("GenStart", 15, 105, 76, 31, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Button2 = GUICtrlCreateButton("GenStop", 120, 105, 76, 31, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Button3 = GUICtrlCreateButton("Copy and Save", 225, 105, 76, 31, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")


GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit

		Case $Button1
			KeyGen()

		Case $Button2
			KeyGenStop()

		Case $Button3
			Copy()
			Saven()


	EndSwitch
WEnd

Func Saven()
	$var = InputBox("PasswortGen", "Geben Sie hier ihren Verwendungszweck ihres generierten Passwortes ein, wenn sie keinen haben geben sie einfach nichts ein.")
	$CurrentKey = GUICtrlRead($label1)
	Filewrite(@DesktopDir & "\PasswortGen.txt","   Ihr Passwort hat den Zweck für ("& $var &") und lautet: "& $CurrentKey&"    |")
	MsgBox(64, "Info", "Eine Infodatei wurde auf ihrem Desktop erstellt die das Passwort und den von ihnen angegebenen Zweck enthällt.")
	EndFunc

Func Copy()
	$CopyKey = GUICtrlRead($label1)
	ClipPut($CopyKey)
EndFunc

Func NurBuchstaben()

	EndFunc

Func KeyGenStop()
    GUICtrlSetState($Button1,$GUI_ENABLE); gen start
	GUICtrlSetState($Button2,$GUI_DISABLE); gen stop
	AdlibUnRegister("CreateKey")

EndFunc   ;==>KeyGenStop


Func KeyGen()
    GUICtrlSetState($Button1,$GUI_DISABLE); gen start
	GUICtrlSetState($Button2,$GUI_ENABLE); gen stop
	AdlibRegister("CreateKey")
EndFunc   ;==>KeyGen

;;;;;;;;;;;;;;;;;;;;;;;DANKE AN autoBert;;;;;;;;;;;;;;;;;;;;;;;;;;

Func CreateKey()
    $iAbruch = Random(5, 19, 1)
    $sKey = ""
    For $iSpalte = 0 To 19
        $iZahlOderBuchstabe = Random(0, 3, 1)
        If not $iZahlOderBuchstabe Then
            $sKey &=  Random(0, 9, 1)
        Else
            $iKlein = Random(0, 3, 1)
            If $iKlein Then
                $sKey &= Chr(Random(97, 122, 1))
            Else
                $sKey &= Chr(Random(65, 90, 1))
            EndIf
        EndIf
        If $iSpalte = $iAbruch Then ExitLoop
    Next
    GUICtrlSetData($Label1,$sKey)
EndFunc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;