#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Version=Beta #AutoIt3Wrapper_icon=icone\devico.ico #AutoIt3Wrapper_outfile=MonRepertoire.exe #AutoIt3Wrapper_Res_Comment=none #AutoIt3Wrapper_Res_Description=Petit programme permettant d'enregistrer ses contactes dans son PC #AutoIt3Wrapper_Res_Fileversion=1.0.0.0 #AutoIt3Wrapper_Res_LegalCopyright=Copyright (C) 2010 - 2011 n0way #AutoIt3Wrapper_Res_Language=1036 #AutoIt3Wrapper_Res_Field=Entreprise|n0way #AutoIt3Wrapper_Res_Field=Créer par|n0way #AutoIt3Wrapper_Res_Field=Email|none #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Region Compiler directives section #EndRegion #include #include #include #include #include #include $nicknick2 = "" $inifile = "contacte.ini" Opt("TrayMenuMode", 0) TrayTip("Mon Repertoire v1.0b", "is loaded.", 30) ;------------------------------ ;- Author : n0way - ;- Formation de la GUI - ;------------------------------ Global $Form1_1 = GUICreate("Mon Repertoire", 353, 397, -1, -1) GUISetIcon("icone\devico.ico", 1) Global $List1 = GUICtrlCreateList("", 8, 8, 105, 342, BitOR($LBS_SORT,$LBS_STANDARD,$LBS_EXTENDEDSEL,$WS_VSCROLL,$WS_BORDER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $Button1 = GUICtrlCreateButton("", 26, 348, 30, 30, BitOR($BS_ICON,$WS_GROUP)) GUICtrlSetImage(-1, "icone\add2.ico", -1) Global $Button2 = GUICtrlCreateButton("", 64, 348, 30, 30, BitOR($BS_ICON,$WS_GROUP)) GUICtrlSetImage(-1, "icone\del2.ico", -1) Global $Button3 = GUICtrlCreateButton("", 305, 348, 30, 30, BitOR($BS_ICON,$WS_GROUP)) GUICtrlSetImage(-1, "icone\check.ico", -1) Global $Group1 = GUICtrlCreateGroup($nicknick2, 120, 0, 225, 388) GUICtrlCreateGroup($nicknick2, -99, -99, 1, 1) Global $Input1 = GUICtrlCreateInput("", 192, 40, 137, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL)) Global $Input2 = GUICtrlCreateInput("", 192, 72, 137, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL)) Global $Input3 = GUICtrlCreateInput("", 192, 128, 137, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL)) Global $Input4 = GUICtrlCreateInput("", 192, 160, 137, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL)) Global $Label1 = GUICtrlCreateLabel("Prenom :", 144, 44, 46, 17) Global $Label2 = GUICtrlCreateLabel("Nom :", 160, 76, 32, 17) Global $Numero = GUICtrlCreateLabel("Numero :", 144, 132, 47, 17) Global $Label3 = GUICtrlCreateLabel("E-mail :", 152, 164, 38, 17) GUISetState(@SW_SHOW) ;------------------------------ ;- Author : n0way - ;- Read a File et l'inserer - ;------------------------------ $var = IniReadSectionNames($inifile) If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else For $i = 1 To $var[0] _GuiCtrlListBox_AddString($List1, $var[$i]) Next EndIf ;------------------------------ ;- Author : n0way - ;- Codage des interactions - ;------------------------------ Func ChangeNameOfGroup($name) GUICtrlDelete($Group1) Global $Group1 = GUICtrlCreateGroup($name, 120, 0, 273, 388) GUICtrlCreateGroup($name, -99, -99, 1, 1) EndFunc Func RefreshList() _GUICtrlListBox_ResetContent($List1) $var = IniReadSectionNames($inifile) If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else For $i = 1 To $var[0] _GuiCtrlListBox_AddString($List1, $var[$i]) Next EndIf EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $name = InputBox("Prenom", "Quel est le prénom de la personne que vous voulez ajouter ?", "", "", 300, 125) if $name <> "" Then _GUICtrlListBox_AddString($List1, $name) IniWriteSection($inifile, $name, "Name=" & @LF & "Tel=" & @LF & "Email=" & @LF & @LF) EndIf Case $Button2 $selitems = _GUICTRLListBox_GetSelItems($List1) $selitemss = _GUICtrlListBox_GetSelItemsText($List1) if $selitems[0] <> 0 Then $test = msgbox(4, "Delete","Etes-vous sûr de vouloir supprimer " & $selitemss[1] & " de vos contactes?") if $test = 6 Then _GUICtrlListBox_DeleteString($List1, $selitems[1]) IniDelete($inifile, $selitemss[1]) EndIf EndIf Case $Button3 $selitems = _GUICTRLListBox_GetSelItems($List1) $selitemss = _GUICtrlListBox_GetSelItemsText($List1) if GUICtrlRead($Input1) <> $selitemss[1] Then IniRenameSection($inifile, $selitemss[1], GUICtrlRead($input1)) RefreshList() EndIf IniWrite($inifile, GUICtrlRead($Input1), "Name", GUICtrlRead($Input2)) IniWrite($inifile, GUICtrlRead($Input1), "Tel", GUICtrlRead($Input3)) IniWrite($inifile, GUICtrlRead($Input1), "Email", GUICtrlRead($Input4)) msgBox(4096, "Edit", "Les modifications ont bien été pris en compte") Case $List1 $selitems2 = _GUICtrlListBox_GetSelItemsText($List1) if $selitems2[0] <> 0 Then $nicknick2 = "Mes Contactes > " & $selitems2[1] GUICTrlSetData($Group1, $nicknick2) GUICtrlSetData($Input1, $selitems2[1]) GUICtrlSetData($Input2, iniRead($inifile, $selitems2[1], "Name", "")) GUICtrlSetData($Input3, iniRead($inifile, $selitems2[1], "Tel", "")) GUICtrlSetData($Input4, iniRead($inifile, $selitems2[1], "Email", "")) EndIf EndSwitch WEnd