Code : Tout sélectionner
#include <Constants.au3>
#include <GUIConstantsEx.au3>
GUICreate("ini add", 360, 220)
GUICtrlCreateLabel("Nom de l'application", 10, 10)
$info1 = GUICtrlCreateInput("", 120, 10, 180, 20)
;-------------------------------------------------------------------------------------
GUICtrlCreateLabel("Executable", 10, 40)
$info2 = GUICtrlCreateInput("", 120, 40, 180, 20)
$btn0 = GUICtrlCreateButton("...", 320, 40, 20, 20)
;-------------------------------------------------------------------------------------
GUICtrlCreateLabel("Parameters", 10, 70)
$info3 = GUICtrlCreateInput("", 120, 70, 180, 20)
;-------------------------------------------------------------------------------------
GUICtrlCreateLabel("WorkingDirectory", 10, 100)
$info4 = GUICtrlCreateInput("", 120, 100, 180, 20)
;-------------------------------------------------------------------------------------
GUICtrlCreateLabel("Author", 10, 130)
$info5 = GUICtrlCreateInput("", 120, 130, 180, 20)
;-------------------------------------------------------------------------------------
GUICtrlCreateLabel("Website", 10, 160)
$info6 = GUICtrlCreateInput("", 120, 160, 180, 20)
;-------------------------------------------------------------------------------------
$btn1 = GUICtrlCreateButton("Ajouter", 10, 190, 80)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $btn0
$Opened_File = FileOpenDialog("Icon files", "", "All exe files (*.exe)|All Files (*.*)",12)
GUICtrlSetData($info2, $Opened_File)
Case $msg = $btn1
$file = FileOpen("Liste.ini", 1)
If $file = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf
FileWriteLine($file, '[' & GUICtrlRead($info1) & ']' & @CRLF)
FileWriteLine($file, 'Executable=' & GUICtrlRead($info2) & @CRLF)
FileWriteLine($file, 'Parameters=' & GUICtrlRead($info3) & @CRLF)
FileWriteLine($file, 'WorkingDirectory=' & GUICtrlRead($info4) & @CRLF)
FileWriteLine($file, 'Author=' & GUICtrlRead($info5) & @CRLF)
FileWriteLine($file, 'Website=' & GUICtrlRead($info6) & @CRLF)
FileClose($file)
Msgbox(0,"ini add","Bien réussi")
ExitLoop
EndSelect
Wend