Code : Tout sélectionner
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 452, 251, 192, 124)
$Choix = GUICtrlCreateCombo("", 296, 56, 137, 25)
$Label2 = GUICtrlCreateLabel("Recettes :", 200, 64, 60, 17)
$NbIngredient = GUICtrlCreateInput("", 312, 24, 121, 21)
$Label1 = GUICtrlCreateLabel("Nombre d'ingrédients :", 192, 24, 109, 17)
$Recette = GUICtrlCreateButton("Rechercher la recette", 280, 208, 120, 25)
$Ingredient = GUICtrlCreateButton("Recherche d'ingrédients", 280, 176, 120, 25)
$Journal = GUICtrlCreateEdit("", 0, 0, 185, 249)
$Metier = GUICtrlCreateCombo("", 288, 104, 145, 25)
GUICtrlSetData(-1, "Cuisine|Patisserie")
$Label3 = GUICtrlCreateLabel("Métier :", 200, 112, 39, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$Ligne = ""
$i = 1
$SavedJournal = ""
$AllIngredient = ""
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Recette
SearchRecette()
Case $Ingredient
SearchIngredient()
EndSwitch
WEnd
Func SearchRecette()
FileOpen (@ScriptDir & "\Recettes.ini", 0)
$Ligne = IniReadSection (@ScriptDir & "\Recettes.ini", GUICtrlRead ($Metier) & "_" & GUICtrlRead ($NbIngredient))
for $i = 1 to $Ligne [0] [0]
$SavedJournal = GUICtrlRead ($Choix)
GUICtrlSetData ($Choix, $SavedJournal & @CRLF & $Ligne [$i] [0])
Next
FileClose (@ScriptDir & "\Recettes.ini")
EndFunc
Func reussite() ;Me sert d'aide pour trouver l'erreur
Msgbox (0, "", "OK")
EndFunc
Func SearchIngredient()
FileOpen (@ScriptDir & "\Recettes.ini")
$AllIngredient = IniRead (@ScriptDir & "\Recettes.ini", GUICtrlRead ($Metier) & "_" & GUICtrlRead ($NbIngredient), GUICtrlRead ($Choix), "Not Found") ;BUG HERe
GUICtrlSetData ($Journal, $AllIngredient)
FileClose (@ScriptDir & "\Recettes.ini")
EndFunc