; ---------------------------------------------------------------------------- ; ; AutoIt-Version: v3.2.0.1 ; ; Programmname: Adressbuch ; Version: ... ; ; Autor: Manuel Kübler ; Mail: mk-software@gmx.de ; ; Skript Function: ; ... ; ; ---------------------------------------------------------------------------- ; ---------------------------------------- ; AutoIT Options ; ---------------------------------------- Opt("GUIOnEventMode", 1) ; Macht Dinge bei einem so großen Skript wesentlich einfacher ; ---------------------------------------- ; Include ; ---------------------------------------- #Include #Include ; ---------------------------------------- ; Variablen-Deklarationen ; ---------------------------------------- $MyDocsFolder = "::{450D8FBA-AD25-11D0-98A8-0800361B1103}" ; ---------------------------------------- ; GUIs ; ---------------------------------------- ; ---------------------------------------- ; MainGUI ; ---------------------------------------- $mainGUI = GUICreate("Adressbuch", 585, 420) GUISetOnEvent(-1, "_file_close") ; ---------------------------------------- ; Menü ; ---------------------------------------- ; Datei $gui_mnu_file = GUICtrlCreateMenu("&Datei") ; Neuer Kontakt $gui_mnu_file_new = GUICtrlCreateMenuitem("Neuer Kontakt", $gui_mnu_file) GUICtrlSetOnEvent(-1, "_file_new") GUICtrlCreateMenuitem("", $gui_mnu_file) ; Importieren $gui_mnu_file_import = GUICtrlCreateMenuitem("Importieren", $gui_mnu_file) GUICtrlSetOnEvent(-1, "_file_import") ; Exportieren $gui_mnu_file_export = GUICtrlCreateMenuitem("Exportieren", $gui_mnu_file) GUICtrlSetOnEvent(-1, "_file_export") GUICtrlCreateMenuitem("", $gui_mnu_file) ; Beenden $gui_mnu_file_close = GUICtrlCreateMenuitem("Beenden", $gui_mnu_file) GUICtrlSetOnEvent(-1, "_file_close") ; Hilfe $gui_mnu_help = GUICtrlCreateMenu("&Hilfe") ; Credits $gui_mnu_help_credts = GUICtrlCreateMenuitem("Credits", $gui_mnu_help) GUICtrlSetOnEvent(-1, "_help_credits") $gui_kontakt_list = GUICtrlCreateListView("Nummer|Vorname|Nachname|E-Mail", 20, 20, 545, 280) _find_contacts() ;GUICtrlCreateListViewItem("|" & IniRead("Adressen\Manuel Kübler.dat", "Kontakt", "Vorname", "") & "|" & IniRead("Adressen\Manuel Kübler.dat", "Kontakt", "Name", "") & "|" & IniRead("Adressen\Manuel Kübler.dat", "Kontakt", "E-Mail", ""), $gui_kontakt_list) ;GUICtrlCreateListViewItem("|" & $read_vorname & "|" & $read_name & "|" & $read_email, $gui_kontakt_list) GUISetState() ; ---------------------------------------- ; Neuer Kontakt-GUI ; ---------------------------------------- $gui_new = GUICreate("Neuer Kontakt", 300, 160) $gui_new_vorname = GUICtrlCreateLabel("Vorname:", 20, 22, 140, 17) $gui_new_vorname_input = GUICtrlCreateInput("Vorname", 100, 20, 153, 20, -1) $gui_new_name = GUICtrlCreateLabel("Name:", 20, 52, 140, 17) $gui_new_name_input = GUICtrlCreateInput("Name", 100, 50, 153, 21, -1) $gui_new_email = GUICtrlCreateLabel("E-Mail:", 20, 82, 140, 17) $gui_new_email_input = GUICtrlCreateInput("E-Mail", 100, 80, 153, 21, -1) $gui_new_save = GUICtrlCreateButton("Speichern", 20, 120, 100, 30) GUICtrlSetOnEvent(-1, "_file_new_save") $gui_new_button1 = GUICtrlCreateButton("Beenden", 133, 120, 100, 30) GUICtrlSetOnEvent(-1, "_file_new_close") ; ---------------------------------------------------------------------------- ; ---------------------------------------- ; Funktionen ; ---------------------------------------- ; Kontake finden Func _find_contacts() $search = FileFindFirstFile(@ScriptDir & "\Adressen\*.dat") While 1 $file = FileFindNextFile($search) If @error Then ExitLoop GUICtrlCreateListViewItem("|" & IniRead($file, "Kontakt", "Vorname", "") & "|" & IniRead($file, "Kontakt", "Name", "") & "|" & IniRead($file, "Kontakt", "E-Mail", ""), $gui_kontakt_list) ; $read_vorname = IniRead($file, "Kontakt", "Vorname", "") ; $read_name = IniRead($file, "Kontakt", "Name", "") ; $read_email = IniRead($file, "Kontakt", "E-Mail", "") ; MsgBox(4096, "File:", $file) WEnd EndFunc ;==>_find_contacts ;Func _find_contacts() ; ; If FileExists("Adressen\*.dat") Then ; IniRead("Adressen\*.dat", "Kontakt", "Vorname", "") = $read_vorname ; IniRead("Adressen\*.dat", "Kontakt", "Name", "") = $read_name ; IniRead("Adressen\*.dat", "Kontakt", "E-Mail", "") = $read_email ; EndIf ; ;EndFunc ;==>_find_contacts ; Datei ; Neuer Kontakt Func _file_new() ; GUISetState(@SW_DISABLE, $mainGUI) GUISetState(@SW_SHOW, $gui_new) GUISetState(@SW_HIDE, $mainGUI) ; MsgBox(320, "Neuer Kontakt", "Diese Schaltfläche hat keine Funktion.") EndFunc ;==>_file_new Func _file_new_save() $path = @ScriptDir & "\Adressen\" & GUICtrlRead($gui_new_vorname_input) & " " & GUICtrlRead($gui_new_name_input) & ".dat" IniWrite($path, "Kontakt", "Vorname", GUICtrlRead($gui_new_vorname_input)) IniWrite($path, "Kontakt", "Name", GUICtrlRead($gui_new_name_input)) IniWrite($path, "Kontakt", "E-Mail", GUICtrlRead($gui_new_email_input)) GuiCtrlCreateListViewItem("|" & GUICtrlRead($gui_new_vorname_input) & "|" & GUICtrlRead($gui_new_name_input) & "|" & GUICtrlRead($gui_new_email_input), $gui_kontakt_list) _file_new_close() ; MsgBox(320, "Speichern", "Diese Schaltfläche hat keine Funktion.") EndFunc ;==>_file_new_save Func _file_new_close() GUISetState(@SW_SHOW, $mainGUI) GUISetState(@SW_Hide, $gui_new) GUISetState(@SW_ENABLE, $mainGUI) EndFunc ; Importieren Func _file_import() MsgBox(320, "Importieren", "Diese Schaltfläche hat keine Funktion.") EndFunc ;==>_file_import ; Exportieren Func _file_export() ; $var = FileSaveDialog("Bitte wählen Sie einen Namen aus.", $MyDocsFolder, "Textdateien (*.txt)", 2) ; If @error Then Exit ; FileWrite($var, "Vorname: " & GUICtrlRead($gui_new_vorname_input) & @CRLF) ; FileWrite($var, "Name: " & GUICtrlRead($gui_new_name_input) & @CRLF) ; FileWrite($var, "E-Mail: " & GUICtrlRead($gui_new_email_input) & @CRLF) MsgBox(320, "Exportieren", "Diese Schaltfläche hat keine Funktion.") EndFunc ;==>_file_eport ; Beenden Func _file_close() Exit EndFunc ;==>_file_close ; ---------------------------------------------------------------------------- ; Hilfe ; Credits Func _help_credits() MsgBox(320, "Credits", "Diese Schaltfläche hat keine Funktion.") EndFunc ;==>_help_credits ; ---------------------------------------------------------------------------- While 1 Sleep(500) WEnd