Sign in to follow this  
Followers 0
melf

Guicombo Help

8 posts in this topic

#1 ·  Posted (edited)

hi

Im trying to have a GUICtrlCreateCombo list the content of a list.txt but somehow everything i tryed failed

this generates the txt file in question

$sShellCmd = "DIR C:\final\*.ini /B > C:\joueursList.txt"
RunWait(@ComSpec & " /c " & $sShellCmd, @TempDir)
_FileReadToArray("C:\joueursList.txt", $avFileArray)

so every line contains only the name of the .ini file i want the combo to load has a list item..

also i tryed loading text in an Edit box but i only get numbers in the $editfirstname editbox..

$editfirstname=GUICtrlCreateInput ("", 96,32,120,20)
GUICtrlSetTip($editfirstname,"Name")

//later on in the script i have this

Case $msg = $openbutton
$message = "Choose a name in the list."
$importplayer = FileOpenDialog($message, "", "File (*.ini)")
$firstname = IniReadSection($importplayer, "firstname")
$data = GUICtrlRead($firstname)
GUICtrlSetData ($editfirstname, $data)

anyone can explain to me what im doing wrong ?

thx

Edited by melf

Share this post


Link to post
Share on other sites



could you post your entire script you got alot of variables and its confusing the crap out of me cuz in ur second example ur declaring firstname as an INIread then your doing a GUIctrlread and its not a Gui function if anything it would be like

Case $msg = $openbutton
$message = "Choose a name in the list."
$importplayer = FileOpenDialog($message, "", "File (*.ini)")
$firstname = IniReadSection($importplayer, "firstname")
GUICtrlSetData($editfirstname, $firstname)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

oups..sorry..quotes and args are in french do

#include <GUIConstants.au3>
#include <file.au3>
#include <array.au3>

Dim $avFileArray

$sShellCmd = "DIR C:\final\*.ini /B > C:\joueursList.txt"
RunWait(@ComSpec & " /c " & $sShellCmd, @TempDir)
_FileReadToArray("C:\joueursList.txt", $avFileArray)

GUICreate("Menu de Database",640,480)
 
$filemenu = GuiCtrlCreateMenu ("Fiche des Joueurs")
$separator1 = GuiCtrlCreateMenuitem ("",$filemenu)
$nombre = GuiCtrlCreateMenuitem ("Nbres de Joueurs",$filemenu)
$openbutton = GuiCtrlCreateMenuitem ("Importer un joueur",$filemenu)
$savebutton = GUICtrlCreateMenuitem ("Sauvarger Modification",$filemenu)
$separator1 = GuiCtrlCreateMenuitem ("",$filemenu)
$helpmenu = GuiCtrlCreateMenu ("?")
$aboutitem = GuiCtrlCreateMenuitem ("Info",$helpmenu)
$exititem = GuiCtrlCreateMenuitem ("Exit",$filemenu)
GuiCtrlCreateLabel("Prénoms", 10, 32)
$monprenom=GUICtrlCreateInput ("", 96,32,120,20)
GUICtrlSetTip($monprenom,"Prenom du Joueur")
GuiCtrlCreateLabel("Noms de famille", 10, 52)
$monnom=GUICtrlCreateInput ("", 96,52,120,20)
GuiCtrlCreateLabel("Adresse", 10, 72)
$monadresse=GUICtrlCreateInput ("", 96,72,120,20)
GuiCtrlCreateLabel("Codepostal", 10, 92)
$moncodepostale=GUICtrlCreateInput ("", 96,92,120,20)
GuiCtrlCreateLabel("Téléphone", 10, 112)
$montelephone=GUICtrlCreateInput ("", 96,112,120,20)
GuiCtrlCreateLabel("Email", 10, 132)
$monemail=GUICtrlCreateInput ("", 96,132,120,20)
GUICtrlCreateLabel("CarteMaladie", 10, 152)
$moncarteass=GUICtrlCreateInput ("",96,152,120,20)
GUICtrlCreateLabel("Nom de perso", 10, 172)
$monnomperso=GUICtrlCreateInput ("",96,172,120,20)
GUICtrlCreateLabel("Race", 10,192)
$monrace=GUICtrlCreateInput ("",96,192,120,20)
GUICtrlCreateLabel("Classe", 10,212)
$monclasse=GUICtrlCreateInput("",96,212,120,20)
GUICtrlCreateLabel("Clan", 10,232)
$monclan=GUICtrlCreateInput("",96,232,120,20)

GuiSetState()

While 1
    $msg = GUIGetMsg()
    

    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop

        Case $msg = $openbutton
            $message = "Choissisez le nom du Joueur."
            $joueurimporter = FileOpenDialog($message, "", "Fiche (*.ini)")
            $prenom = IniReadSection($joueurimporter, "Prenoms")
            $argnom = IniReadSection($joueurimporter, "Noms")
            $argadresse = IniReadSection($joueurimporter, "Adresse")
            $argcodepostale = IniReadSection($joueurimporter, "CodePostale")
            $argtelephone = IniReadSection($joueurimporter, "Telephone")
            $argemail = IniReadSection($joueurimporter, "Email")
            $data = GUICtrlRead($prenom)
            GUICtrlSetData ($monprenom, $data)
            GUICtrlSetData ( $monnom, $argnom)  
            GUICtrlSetData ( $monadresse, $argadresse)  
            GUICtrlSetData ( $moncodepostale, $argcodepostale)  
            GUICtrlSetData ( $montelephone, $argtelephone)  
            GUICtrlSetData ( $monemail, $argemail)  
            
        Case $msg = $savebutton
            $prenom=GUICtrlRead ($monprenom)
            $delim="-"
            $nom=GUICtrlRead ($monnom)
            $joueurimporter = $prenom & $delim & $nom & ".ini"
            IniWrite($joueurimporter, "Prenom", "info", $prenom)
            IniWrite($joueurimporter, "Noms", "info", $nom) 
            $adresse=GUICtrlRead ($monadresse)
            IniWrite($joueurimporter, "Adresse", "info", $adresse)
            $codepostale=GUICtrlRead ($moncodepostale)
            IniWrite($joueurimporter, "CodePostale", "info", $codepostale)
            $telephone=GUICtrlRead ($montelephone)
            IniWrite($joueurimporter, "Telephone", "info", $telephone)
            $email=GUICtrlRead ($monemail)
            IniWrite($joueurimporter, "Email", "info", $email)  
            GUICtrlSetData ( $monprenom, "")    
            GUICtrlSetData ( $monnom, "")   
            GUICtrlSetData ( $monadresse, "")   
            GUICtrlSetData ( $moncodepostale, "")   
            GUICtrlSetData ( $montelephone, "") 
            GUICtrlSetData ( $monemail, "")             
            
        Case $msg = $nombre
            $CountLines = _FileCountLines("C:\joueursList.txt")
            MsgBox(64, "Joueurs Inscrit", "Il y a " & $CountLines & " joueurs d'inscrit.")
            
        Case $msg = $aboutitem
            Msgbox(0,"Lecteur Database Imladris","Une Compillation Melf 2006")
    EndSelect
WEnd

GUIDelete()

Exit
Edited by melf

Share this post


Link to post
Share on other sites

i threw together a quick example here

#include <GUIConstants.au3>
#include <File.au3>
_FileCreate("firstname.ini")
IniWrite("firstname.ini","Name","Firstname","Thatsgreat2345")
$Form1 = GUICreate("AForm1", 313, 92, 212, 181)
$editfirstname = GUICtrlCreateInput("", 8, 32, 185, 37, -1, $WS_EX_CLIENTEDGE)
$openbutton = GUICtrlCreateButton("Open", 224, 32, 49, 25)
GUISetState(@SW_SHOW)

Do
    $msg = GUIGetMsg()
    Select
Case $msg = $openbutton
$message = "Choose a name in the list."
$importplayer = FileOpenDialog($message,@ScriptDir,"Files (*ini)")
$firstname = IniRead($importplayer,"Name","Firstname","")
GUICtrlSetData($editfirstname, $firstname)
EndSelect
Until $msg = $GUI_EVENT_CLOSE

Share this post


Link to post
Share on other sites

:) thx

any ideas on how to load the joueursList.txt in a combobox list?

Share this post


Link to post
Share on other sites

Ive never really used the CMD but whats

$sShellCmd = "DIR C:\final\*.ini /B > C:\joueursList.txt"
RunWait(@ComSpec & " /c " & $sShellCmd, @TempDir)
_FileReadToArray("C:\joueursList.txt", $avFileArray)

i see its reading the list at the end but

is it creating a new file or what?

Share this post


Link to post
Share on other sites

oups sorry it used to show in an array i removed.

Share this post


Link to post
Share on other sites

try this

#include <GUIConstants.au3>
#include <file.au3>
GUICreate("Menu de Database",640,480)
$filemenu = GuiCtrlCreateMenu ("Fiche des Joueurs")
$separator1 = GuiCtrlCreateMenuitem ("",$filemenu)
$nombre = GuiCtrlCreateMenuitem ("Nbres de Joueurs",$filemenu)
$openbutton = GuiCtrlCreateMenuitem ("Importer un joueur",$filemenu)
$savebutton = GUICtrlCreateMenuitem ("Sauvarger Modification",$filemenu)
$separator1 = GuiCtrlCreateMenuitem ("",$filemenu)
$helpmenu = GuiCtrlCreateMenu ("?")
$aboutitem = GuiCtrlCreateMenuitem ("Info",$helpmenu)
$exititem = GuiCtrlCreateMenuitem ("Exit",$filemenu)
GuiCtrlCreateLabel("Prénoms", 10, 32)
$monprenom=GUICtrlCreateInput ("", 96,32,120,20)
GUICtrlSetTip($monprenom,"Prenom du Joueur")
GuiCtrlCreateLabel("Noms de famille", 10, 52)
$monnom=GUICtrlCreateInput ("", 96,52,120,20)
GuiCtrlCreateLabel("Adresse", 10, 72)
$monadresse=GUICtrlCreateInput ("", 96,72,120,20)
GuiCtrlCreateLabel("Codepostal", 10, 92)
$moncodepostale=GUICtrlCreateInput ("", 96,92,120,20)
GuiCtrlCreateLabel("Téléphone", 10, 112)
$montelephone=GUICtrlCreateInput ("", 96,112,120,20)
GuiCtrlCreateLabel("Email", 10, 132)
$monemail=GUICtrlCreateInput ("", 96,132,120,20)
GUICtrlCreateLabel("CarteMaladie", 10, 152)
$moncarteass=GUICtrlCreateInput ("",96,152,120,20)
GUICtrlCreateLabel("Nom de perso", 10, 172)
$monnomperso=GUICtrlCreateInput ("",96,172,120,20)
GUICtrlCreateLabel("Race", 10,192)
$monrace=GUICtrlCreateInput ("",96,192,120,20)
GUICtrlCreateLabel("Classe", 10,212)
$monclasse=GUICtrlCreateInput("",96,212,120,20)
GUICtrlCreateLabel("Clan", 10,232)
$monclan=GUICtrlCreateInput("",96,232,120,20)
GuiSetState()

Do
    $msg = GUIGetMsg()
    Select
        Case $msg = $exititem
            Exit
        Case $msg = $openbutton
            $message = "Choissisez le nom du Joueur."
            $file = FileOpenDialog($message, "", "Fiche (*.ini)")
            GUICtrlSetData ($monprenom,IniRead($file, "Prenom", "info",""))
            GUICtrlSetData ( $monnom,IniRead($file, "Noms", "info",""))
            GUICtrlSetData ( $monadresse,IniRead($file, "Adresse", "info",""))
            GUICtrlSetData ( $moncodepostale,  IniRead($file, "CodePostale", "info",""))
            GUICtrlSetData ( $montelephone,IniRead($file, "Telephone", "info",""))
            GUICtrlSetData ( $monemail,IniRead($file, "Email", "info", ""))
            GUICtrlSetData ( $moncarteass, IniRead($file, "Cart", "info", ""))
            GUICtrlSetData ( $monnomperso, IniRead($file, "Perso", "info",""))
            GUICtrlSetData ( $monrace, IniRead($file, "Race", "info",""))
            GUICtrlSetData ( $monclasse,IniRead($file, "Class", "info",""))
            GUICtrlSetData ( $monclan,IniRead($file, "Clan", "info",""))    
        Case $msg = $savebutton
            _FileCreate("info.ini")
            $delim="-"
            $file = "info.ini"
            IniWrite($file, "Prenom", "info", GUICtrlRead ($monprenom))
            IniWrite($file, "Noms", "info", GUICtrlRead ($monnom))
            IniWrite($file, "Adresse", "info", GUICtrlRead ($monadresse))
            IniWrite($file, "CodePostale", "info", GUICtrlRead ($moncodepostale))
            IniWrite($file, "Telephone", "info", GUICtrlRead ($montelephone))
            IniWrite($file, "Email", "info", GUICtrlRead ($monemail)) 
            IniWrite($file, "Cart", "info", GUICtrlRead ($moncarteass)) 
            IniWrite($file, "Perso", "info", GUICtrlRead ($monnomperso))
            IniWrite($file, "Race", "info", GUICtrlRead ($monrace)) 
            IniWrite($file, "Class", "info", GUICtrlRead ($monclasse)) 
            IniWrite($file, "Clan", "info", GUICtrlRead ($monclan)) 
            GUICtrlSetData($monprenom,"")
            GUICtrlSetData($monnom,"")
            GUICtrlSetData($monadresse,"")
            GUICtrlSetData($moncodepostale,"")
            GUICtrlSetData($montelephone,"")
            GUICtrlSetData($monemail,"")
            GUICtrlSetData($moncarteass,"")
            GUICtrlSetData($monnomperso,"")
            GUICtrlSetData($monrace,"")
            GUICtrlSetData($monclasse,"")
            GUICtrlSetData($monclan,"")
        Case $msg = $nombre
            If FileExists("C:\joueursList.txt") Then
            MsgBox(0,"No File","Sorry File Doesn't Exist")
            Else
            MsgBox(64, "Joueurs Inscrit", "Il y a " & _FileCountLines("C:\joueursList.txt") & " joueurs d'inscrit.")
            EndIf
        Case $msg = $aboutitem
            Msgbox(0,"Lecteur Database Imladris","Une Compillation Melf 2006")
    EndSelect
Until $msg = $GUI_EVENT_CLOSE

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0