Hi an alle,
ich hab gestern schonmal gefragt, wie man das mit den Textdateien hinbekommt, dass es das Script anzeigt, hab mein Login-Script also fertig. Ich hab mir nun gedacht, ich mache so als Übung ein Programm, bei dem man nach Eingabe eines Kennworts alle anderen einsehen kann (ich teste noch, also von Verschlüsseln ist noch nicht die Rede). Ich weiß, klingt simpel, aber wenn ich mich einlogge und auf hinzufügen klicke, schließt das Script einfach.
Sieht folgendermaßen aus:
[autoit]#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Login", 301, 110, 192, 124)
$BenutzerID = GUICtrlCreateLabel("Benutzer-ID:", 8, 8, 76, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$BenutzerIDEingabe = GUICtrlCreateInput("", 85, 6, 209, 21)
$Passwort = GUICtrlCreateLabel("Passwort:", 8, 32, 62, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$PasswortEingabe = GUICtrlCreateInput("", 85, 30, 209, 21)
$Speichern = GUICtrlCreateButton("Daten speichern", 149, 56, 145, 25, 0)
$Login = GUICtrlCreateButton("Einloggen", 5, 56, 145, 25, 0)
$LoginBeenden = GUICtrlCreateButton("Loginprozess abbrechen", 5, 80, 289, 25, 0)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Speichern
$GesicherteBenutzerID = GUICtrlRead($BenutzerIDEingabe)
$GesichertesPasswort = GUICtrlRead($PasswortEingabe)
IniWrite(@ScriptDir & "\Logindaten.ini", "Login", "Username", $GesicherteBenutzerID)
IniWrite(@ScriptDir & "\Logindaten.ini", "Login", "Password", $GesichertesPasswort)
Case $LoginBeenden
Exit
Case $Login
$BID = GUICtrlRead($BenutzerIDEingabe)
$PW = GUICtrlRead($PasswortEingabe)
$GesicherteBenutzerID = IniRead(@ScriptDir & "\Logindaten.ini", "Login", "Username", "")
$GesichertesPasswort = IniRead(@ScriptDir & "\Logindaten.ini", "Login", "Password", "")
If $PW = $GesichertesPasswort And $BID = $GesicherteBenutzerID Then
MsgBox(0, "Loginprozess", "Sie haben sich erfolgreich eingeloggt!")
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=F:\Programme\AutoIt\Koda Form Designer\Forms\PWSaver.kxf
$Form1 = GUICreate("Passwort Manager 2010", 608, 250, 192, 124)
GUISetFont(10, 400, 0, "Arial Narrow")
$Label1 = GUICtrlCreateLabel("Verwendung:", 8, 8, 79, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Label2 = GUICtrlCreateLabel("Benutzer-ID:", 128, 8, 76, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Label3 = GUICtrlCreateLabel("Passwort:", 248, 8, 62, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Input_Verwendung = GUICtrlCreateInput("", 8, 32, 113, 24)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Input_ID = GUICtrlCreateInput("", 128, 32, 113, 24)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Input_PW = GUICtrlCreateInput("", 248, 32, 113, 24)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Label4 = GUICtrlCreateLabel("Website:", 368, 8, 56, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Input_URL = GUICtrlCreateInput("", 368, 32, 113, 24)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$HinzufuegenButton = GUICtrlCreateButton("Hinzufügen", 488, 32, 97, 25, 0)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Label5 = GUICtrlCreateLabel("Verwendung:", 8, 70, 79, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Label6 = GUICtrlCreateLabel("Benutzer-ID:", 130, 70, 76, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Label7 = GUICtrlCreateLabel("Passwort:", 241, 70, 62, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Label8 = GUICtrlCreateLabel("Website:", 358, 70, 56, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Label9 = GUICtrlCreateLabel("", 8, 96, 4, 4)
$Verwendung = GUICtrlCreateEdit("", 8, 96, 113, 121)
GUICtrlSetData(-1, "Verwendung")
GUICtrlSetFont(-1, 10, 400, 2, "Arial")
$BenutzerID = GUICtrlCreateEdit("", 128, 96, 105, 121)
GUICtrlSetData(-1, "BenutzerID")
GUICtrlSetFont(-1, 10, 400, 2, "Arial")
$Passwort = GUICtrlCreateEdit("", 240, 96, 113, 121)
GUICtrlSetData(-1, "Passwort")
GUICtrlSetFont(-1, 10, 400, 2, "Arial")
$Website = GUICtrlCreateEdit("", 360, 96, 105, 121)
GUICtrlSetData(-1, "Website")
GUICtrlSetFont(-1, 10, 400, 2, "Arial")
$Aktionswahl = GUICtrlCreateCombo("Daten löschen", 472, 96, 121, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Aktionsbutton = GUICtrlCreateButton("Aktion ausführen", 472, 122, 121, 25, 0)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$AusloggenButton = GUICtrlCreateButton("Ausloggen", 472, 148, 121, 25, 0)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Credits = GUICtrlCreateButton("Credits zeigen", 472, 176, 121, 25, 0)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Menu_Datei = GUICtrlCreateMenu("Datei")
$Menu_Ausloggen = GUICtrlCreateMenuItem("Ausloggen", $Menu_Datei)
$Menu_Beenden = GUICtrlCreateMenuItem("Beenden", $Menu_Datei)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $HinzufuegenButton
$VerwendungGelesen = GUICtrlRead($Input_Verwendung)
$IDGelesen = GUICtrlRead($Input_ID)
$PWGelesen = GUICtrlRead($Input_PW)
$URLGelesen = GUICtrlRead($Input_URL)
IniWrite(@ScriptDir & "\Einstellungen.ini", "Verwendung", "Login", "Password", "Website", $VerwendungGelesen)
IniWrite(@ScriptDir & "\Einstellungen.ini", "Verwendung", "Login", "Password", "Website", $IDGelesen)
IniWrite(@ScriptDir & "\Einstellungen.ini", "Verwendung", "Login", "Password", "Website", $PWGelesen)
IniWrite(@ScriptDir & "\Einstellungen.ini", "Verwendung", "Login", "Password", "Website", $URLGelesen)
MsgBox(1,"Passwort Manager 2010", "Datenspeicherung erfolgreich!")
Case $Menu_Ausloggen
MsgBox(1,"Ausloggen", "Möchten Sie sich wirklich ausloggen?")
If 1 then
Exit
EndIf
EndSwitch
WEnd
Else
MsgBox(0, "Loginprozess", "Die von ihnen eingegebene Benutzer-ID oder das Passwort sind nicht korrekt.")
EndIf
EndSwitch
WEnd
Seid nicht zu streng mit mir, ist erst mein 1. Versuch ein kleines Programm hinzubekommen.
Danke schonmal ![]()