Jump to content

iniwrite & GUICtrlCreateEdit


Recommended Posts

Hello everybody,

at the begin of my program is following code:

#Region Einlesen der Ini Datei --> informationen.ini & logbuch.ini
$file39 = IniRead(@ScriptDir & "\ini-Dateien\informationen.ini", 'Informationen', 'Informationen', '')
$file42 = IniRead(@ScriptDir & "\ini-Dateien\logbuch.ini", 'Logbuch', 'Logbuch', '')
#EndRegion Einlesen der Ini Datei --> informationen.ini & logbuch.ini

This is the other code in the program:

$input39 = GUICtrlCreateEdit($file39, 15, 25, 760, 240)
GUICtrlSetState($input39, $file39)
$ButtonSichern3 = GUICtrlCreateButton("Sichern", 780, 100)
GUICtrlSetOnEvent(-1, "Sichern3")

#Region Informationen sichern
Func Sichern3()
If Not FileExists(@ScriptDir & "\ini-Dateien") Then
    DirCreate(@ScriptDir & "\ini-Dateien")
EndIf
If FileExists(@ScriptDir & "\ini-Dateien") Then
    IniWrite(@ScriptDir & "\ini-Dateien\informationen.ini", "Informationen", "Informationen", GUICtrlRead($input39))
EndIf
EndFunc  ;==>Sichern3
#EndRegion Informationen sichern

So if somebody press Return, if he writes in the "GUICtrlCreateEdit", it will be saved in the ini file, like this:

[informationen]Informationen=Info von Marc

Info2

And if the user opened the program at second time, the value of the second line "Info2" will not be displayed. Can somebody say me how to solve this?
Link to comment
Share on other sites

  • Replies 41
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

so every time u want sum ro write in the edit box it writes a new value ... example

[Informationen]
Informationen=Info von Marc
Informationen2= blah
Informationen3= blah 
Informationen4= blah
etc

? is that right?

qq

Link to comment
Share on other sites

Take a look at this Script I wrote. Also take note of the Variables $count and $newcount. I did what you want to do with the Ini read, not write. Its a big script, I never finished the whole script, but what I have works perfect.

#include <GUIConstants.au3>

#region - Global

Global $MainGUI; THE MAIN GUI
Global $Width = 700; THE WIDTH OF ALL GUIS
Global $Height = 500; THE HEIGHT OF ALL GUIS
Global $Filemenu; FILE MENU IN THE MAIN GUI 
Global $Newgameitem; ITEM IN THE FILE MENU OF THE MAIN GUI
Global $Saveitem; SAVES THE GAME
Global $Exititem; ITEM IN THE FILE MENU OF THE MAIN GUI
Global $ButtonA; BUTTON NAMED 'A' IN THE MAIN GUI
Global $ButtonB; BUTTON NAMED 'B' IN THE MAIN GUI
Global $ButtonC; BUTTON NAMED 'C' IN THE MAIN GUI
Global $LastMessage = Iniread ( "Character.ini", "lastmessage","lastmessage", "error")
Global $Questlabel; A LABEL USED TO TRANSMIT THE DATA FROM THE Quest.INI FILE TO THE MAIN GUI 

Global $msg; IS USED TO GET THE MESSAGES FROM THE GUI

Global $ReadQuestLabel = GUICtrlRead($questlabel)
Global $Newcount = IniRead ("Character.ini", "Counter", "count", "0" ) + 1; IS USED WITH - Iniwrite ( "Character.ini", "Counter", "count", $Newcount ) - SO THAT $Count = IniRead ("Character.ini", "Counter", "count", "0" ) - WILL EQUAL A NEW VALUE
Global $Count = IniRead ("Character.ini", "Counter", "count", "0" ); IS USED WITH $QuestA, $QuestB AND $QuestC SO THAT THEY WILL READ DIFFERENT LINES AS THE BUTTONS A, B AND C ARE PUSH AND THEN SEND THE DATA TO THE LABEL NAMED $Questlabel
Global $QuestA = IniRead ("Quest.ini", "QuestA",$Count,"error"); DATA TO BE SENT TO THE LABEL
Global $QuestB = IniRead ("Quest.ini", "QuestB",$Count,"error"); DATA TO BE SENT TO THE LABEL
Global $QuestC = IniRead ("Quest.ini", "QuestC",$Count,"error"); DATA TO BE SENT TO THE LABEL


Global $characterName = IniRead ( "character.ini", "character", "name", "unknown" )
Global $maxlife = IniRead ( "character.ini", "character", "maxlife", "unknown" )
Global $Nmaxlife = number($maxlife)
Global $Life = IniRead ( "character.ini", "character", "life", "unknown" )
Global $Nlife = Number($life)
Global $def = IniRead ( "character.ini", "character", "def", "unknown" )
Global $tohit = IniRead ( "character.ini", "character", "tohit", "unknown" )
Global $dam = IniRead ( "character.ini", "character", "dam", "unknown" )

#region - Character Setup GUI Globals



Global $CharactersetupGUI 
Global $SetupIntroLabel 
Global $SetupPointsLabel
Global $SetupNameLabel
Global $NameInput
Global $PlusLifeButton
Global $SetupLifeLabel
Global $SetupLifePointsLabel
Global $MinusLifeButton
Global $SetupStatsGroup
Global $SetupDefLabel
Global $SetupDefPointsLabel 
Global $SetupToHitLabel
Global $SetupToHitPointsLabel
Global $SetupDamLabel
Global $SetupDamPointsLabel
Global $AddDefButton
Global $AddToHitButton
Global $AddDamButton
Global $MinusDefButton
Global $MinusToHitButton
Global $MinusDamButton
Global $FinishedSetupButton
Global $ReadSetupPointsLabel = GUICtrlRead($SetupPointsLabel)
Global $NumberReadInitalSetupPointsLabel = Number($ReadSetupPointsLabel)


#endregion
#region - Combat GUI Globals
Global $CombatGUI; THE GUI USED FOR COMBAT IN THE GAME(THIS GUI IS STILL BARE)
Global $ButtonAttack; A BUTTON IN THE COMBAT GUI THAT IS TO BE USED TO ATTACK
Global $ButtonDefend
Global $ButtonRun


#endregion

#region - Dices rolls Globals
Global $1d10
Global $4d10
#endregion


#Region - RPG GUI Create
$MainGUI = GUICreate ("RPG",$width, $Height)

$Filemenu = GuiCtrlCreateMenu ("File")
$Newgameitem = GUICtrlCreateMenuitem ("New Game", $Filemenu)
$Saveitem = GUICtrlCreateMenuitem ("Save", $Filemenu)
$Exititem = GuiCtrlCreateMenuitem ("Exit", $Filemenu)
$ButtonA = GUICtrlCreateButton ("A.", 100,440,70,20)
$ButtonB = GUICtrlCreateButton ("B.", 235,440,70,20)
$ButtonC = GUICtrlCreateButton ("C.", 370,440,70,20)
$LastMessage = Iniread ( "Character.ini", "lastmessage","lastmessage", "error")
$Questlabel = GUICtrlCreateEdit($LastMessage, 12,20, 509, 399,$ES_READONLY+$WS_VSCROLL);THE STARTING LINE OF THE LABEL
GUICtrlSetData($Questlabel,$LastMessage)
GUICtrlCreateGroup("",9,10,510,400)
;BETWEEN COLUMES 1 AND 2 AND ON TOP OF

GUICtrlCreateGroup($characterName ,550,10,140,400)
            
             
            GUICtrlCreateLabel ("Max Life",  565, 55, 40, 15)
            GUICtrlCreateLabel ("Life",  565, 70, 40, 15)
            GUICtrlCreateLabel ("Def",  565, 85, 40, 15)
            GUICtrlCreateLabel ("To Hit",  565, 100, 40, 15) 
            GUICtrlCreateLabel ("Dam",  565, 115, 40, 15) 
           ;COLUME 2            
 
            GUICtrlCreateLabel ($MaxLife,  635, 55, 40, 15)
        
$LifeLabel = GUICtrlCreateLabel ($life,  635, 70, 40, 15) 
GUICtrlSetData($LifeLabel,$life) 

            GUICtrlCreateLabel ($Def,  635, 85, 40, 15)
            GUICtrlCreateLabel ($ToHit,  635, 100, 40, 15) 
            

GuiSetState(@SW_SHOW)
#endregion

#region - Combat GUI Create
$CombatGUI = GUICreate ("Combat", $width, $Height)
$ButtonAttack = GUICtrlCreateButton ("Attack.", 100,440,70,20)
$ButtonDefend = GUICtrlCreateButton ("Defend", 315,440,70,20)
$ButtonRun = GUICtrlCreateButton ("Run.", 530,440,70,20)

;BETWEEN COLUMES 1 AND 2 AND ON TOP OF THEM
            GUICtrlCreateGroup($characterName ,550,10,140,400) 
        ;COLUME 1
            
            GUICtrlCreateLabel ("Max Life",  565, 55, 40, 15)
            GUICtrlCreateLabel ("Life",  565, 70, 40, 15)           
            GUICtrlCreateLabel ("Def",  565, 85, 40, 15)
            GUICtrlCreateLabel ("To Hit",  565, 100, 40, 15) 
            GUICtrlCreateLabel ("Dam",  565, 115, 40, 15) 
           ;COLUME 2            
             
            GUICtrlCreateLabel ($MaxLife,  635, 55, 40, 15)
            GUICtrlCreateLabel ($Life,  635, 70, 40, 15)            
            GUICtrlCreateLabel ($Def,  635, 85, 40, 15)
            GUICtrlCreateLabel ($ToHit,  635, 100, 40, 15) 
            GUICtrlCreateLabel ($Dam,  635, 115, 40, 15) 
GuiSetState(@SW_HIDE)
#endregion

#region - Character Setup  GUI Create 
If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

Global $CharactersetupGUI = GuiCreate("Character Setup", 502, 463,(@DesktopWidth-502)/2, (@DesktopHeight-463)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS); THE GUI THAT IS USED TO SET UP THE CHARACTER IN THE GAME AT THE START(THIS GUI IS STILL BARE)
$SetupIntroLabel = GuiCtrlCreateLabel("To set your stats, use the '-' and '+' buttons. Use all of the your points or choose not to in order to make your game harder.", 60, 50, 380, 30)

$SetupPointsLabel = GuiCtrlCreateLabel("10", 190, 120, 120, 30)
GUICtrlSetData($SetupPointsLabel,"10")
$SetupNameLabel = GuiCtrlCreateLabel("Please enter your name.  -------->", 60, 20, 190, 20)
$NameInput = GuiCtrlCreateInput("Name", 250, 20, 190, 20)
$PlusLifeButton = GuiCtrlCreateButton("+", 80, 170, 30, 30)
$SetupLifeLabel = GuiCtrlCreateLabel("Life", 120, 170, 120, 30)
$SetupLifePointsLabel = GuiCtrlCreateLabel("1", 260, 170, 120, 30)
$MinusLifeButton = GuiCtrlCreateButton("-", 390, 170, 30, 30)
$SetupStatsGroup = GuiCtrlCreateGroup("STATS", 60, 100, 380, 250)
$SetupDefLabel = GuiCtrlCreateLabel("Defense", 120, 210, 120, 30)
$SetupDefPointsLabel = GuiCtrlCreateLabel("2", 260, 210, 120, 30)
$SetupToHitLabel = GuiCtrlCreateLabel("To hit defense 20", 120, 250, 120, 30)
$SetupToHitPointsLabel = GuiCtrlCreateLabel("3", 260, 250, 120, 30)
$SetupDamLabel = GuiCtrlCreateLabel("Damage", 120, 290, 120, 30)
$SetupDamPointsLabel = GuiCtrlCreateLabel("4", 260, 290, 120, 30)
$AddDefButton = GuiCtrlCreateButton("+", 80, 210, 30, 30)
$AddToHitButton = GuiCtrlCreateButton("+", 80, 250, 30, 30)
$AddDamButton = GuiCtrlCreateButton("+", 80, 290, 30, 30)
$MinusDefButton = GuiCtrlCreateButton("-", 390, 210, 30, 30)
$MinusToHitButton = GuiCtrlCreateButton("-", 390, 250, 30, 30)
$MinusDamButton = GuiCtrlCreateButton("-", 390, 290, 30, 30)
$FinishedSetupButton = GuiCtrlCreateButton("Finished", 120, 360, 260, 60)
GuiSetState(@SW_HIDE)


#endregion

#Region - GUI SelectLoop

While 1
    $msg = GUIGetMsg()

Select

    Case $msg = -3;$GUI_EVENT_CLOSE
        Iniwrite ( "Character.ini", "Counter", "count", "0" ); THIS IS TEMPORARY LINE SO I DON'T HAVE TO REWRITE THE VALUE OF THE COUNT IN THE CHARACTER.INI FILE. I PLAN ON REMOVING IT WHEN I AM DONE SO THAT BY NOT RESETTING THE VAULE TO ZERO IT WILL BE LIKE AN AUTOMATIC WAY OF SAVING THE GAME IN PROGRESS.
    ExitLoop

    Case $msg = $Newgameitem
        Call("_setupPointsMinValue")
        Iniwrite ( "Character.ini", "Counter", "count", "0" )
        Iniwrite ( "Character.ini", "lastmessage","lastmessage", "Choose your quest in life; A,B or C"); CHANGE ME TEMPORARY LINE, CHANGE ME
        $ReadSetupPointsLabel = GUICtrlRead($SetupPointsLabel); not needed, may need later in different location
        $NumberReadInitalSetupPointsLabel = Number($ReadSetupPointsLabel); not needed, may need later in different location
        Call("_8d10")
        GUICtrlSetData($SetupPointsLabel,40 + $4d10)
        $LastMessage = Iniread ( "Character.ini", "lastmessage","lastmessage", "error")
        GUICtrlSetData($Questlabel,$LastMessage);RESETS THE LABEL TO START
        
        GUISetState(@SW_HIDE,$MainGUI)
        GUISetState(@SW_SHOW,$CharactersetupGUI)
        GUISetState(@SW_HIDE,$CombatGUI)
        
        
        
    Case $msg = $exititem
        
        $Readlastcoubt = IniRead ( "Character.ini", "lastmessage","lastcount")
        Iniwrite ( "Character.ini", "Counter", "count", $Readlastcoubt );
            ExitLoop
    Case $msg = $Saveitem
        $ReadQuestLabel = GUICtrlRead($questlabel)
        Iniwrite ( "Character.ini", "lastmessage","lastmessage", $ReadQuestLabel)   
        $Count = IniRead ("Character.ini", "Counter", "count", "0" )
        Iniwrite ( "Character.ini", "lastmessage","lastcount", $Count)
        
    Case $msg = $ButtonA 
         Call("_NexlineonQuestA") 
         Call ("_Add1tolife") 
         
    Case $msg = $ButtonB 
         Call("_NexlineonQuestB") 
         Call ("_Add1tolife")           

    Case $msg = $ButtonC 
        Call("_NexlineonQuestC")
        Call ("_Add1tolife")            
        
    Case $QuestA = "combat"  
        call("_Swaptocombat")
        Call("_NexlineonQuestA")
        
    Case $QuestB = "combat"  
        call("_Swaptocombat")
        Call("_NexlineonQuestB")
        
    Case $QuestC = "combat"  
        call("_Swaptocombat")
        Call("_NexlineonQuestC")
    Case $msg = $ButtonRun 
        Call("_Swaptomaingui")
    Case $msg = $FinishedSetupButton
        Call("_Swaptomaingui")
            
EndSelect

WEnd
#EndRegion
; Start - Functions
Func _8d10()
    $1d10 = Random(1,10,1)
    If $1d10 > 0 Then
    $4d10 = $1d10 + $1d10 + $1d10 + $1d10
EndIf
EndFunc

        
Func _Add1tolife()
    If $NLife < $Nmaxlife Then
         $Lifeplusone = IniRead ("Character.ini", "character", "life", "0" ) + 1
         $Nlifeplusone = Number($Lifeplusone)
         IniWrite ("Character.ini", "character", "life", $NLifeplusone )
         $Life = IniRead ( "character.ini", "character", "life", "unknown" )
         $Nlife = Number($life) 
         GUICtrlSetData($LifeLabel,$NLife)
          EndIf
EndFunc

Func _Swaptocombat()
    GUISetState(@SW_HIDE,$MainGUI)
    GUISetState(@SW_HIDE,$CharactersetupGUI)
    GUISetState(@SW_SHOW,$CombatGUI)
EndFunc

Func _Swaptomaingui()
    GUISetState(@SW_SHOW,$MainGUI)
    GUISetState(@SW_HIDE,$CharactersetupGUI)
    GUISetState(@SW_HIDE,$CombatGUI)
EndFunc
Func _NexlineonQuestA()
    $Newcount = IniRead ("Character.ini", "Counter", "count", "0" ) + 1
         Iniwrite ( "Character.ini", "Counter", "count", $Newcount )
         $Count = IniRead ("Character.ini", "Counter", "count", "0" )
         $QuestA = IniRead ("Quest.ini", "QuestA",$Count,"error")
         GUICtrlSetData($Questlabel,$QuestA);CHANGES THE DATA IN THE LABEL TO $QuestA
EndFunc

Func _NexlineonQuestB()
    $Newcount = IniRead ("Character.ini", "Counter", "count", "0" ) + 1
         Iniwrite ( "Character.ini", "Counter", "count", $Newcount )
         $Count = IniRead ("Character.ini", "Counter", "count", "0" )
         $QuestB = IniRead ("Quest.ini", "QuestB",$Count,"error")
         GUICtrlSetData($Questlabel,$QuestB);CHANGES THE DATA IN THE LABEL TO $QuestB
EndFunc

Func _NexlineonQuestC()
    $Newcount = IniRead ("Character.ini", "Counter", "count", "0" ) + 1
         Iniwrite ( "Character.ini", "Counter", "count", $Newcount )
         $Count = IniRead ("Character.ini", "Counter", "count", "0" )
         $QuestC = IniRead ("Quest.ini", "QuestC",$Count,"error")
         GUICtrlSetData($Questlabel,$QuestC);CHANGES THE DATA IN THE LABEL TO $QuestC
EndFunc

HERE IS QUEST.INI

[QuestA]
1=a1
2=a2
3=3a
4=a4
5=a5
6=a6
7=a7
8=a8
9=a9
10=a10
11=a11
12=a12
13=a13
14=a14
15=a15
16=a16
[QuestB]
1=b1
2=b2
3=b3
4=b4
5=b5
6=b6
7=b7
8=b8
9=b9
10=b10
11=b11
12=b12
13=b13
14=b14
15=b15
16=b16
[QuestC]
1=c1
2=c2
3=c3
4=c4
5=c5
6=c6
7=c7
8=c8
9=c9
10=c10
11=c11
12=c12
13=c13
14=c14
15=c15
16=c16
[1]
encountertext=
name=monster1
maxlife=20
life=1
def=9
tohit=8
dam=7
itemcode=
[2]
encountertext=
name=monster2
maxlife=20
life=1
def=9
tohit=8
dam=7
itemcode=
[Itemcode];code for reading the item
1=
[Itemcodetext];this well go with the itemcode, for display purpose only.
1=

HERE IS CHARACTER.INI

[character]
name=quick_sliver007
maxlife=20
life=20
def=9
tohit=8
dam=7
[Counter]
count=0

[lastsave]
lastmessage=Choose your quest in life; A,B or C
lastcount=2
Lastquestfile=quest1.ini

[lastmessage]
lastmessage=Choose your quest in life; A,B or C

So try this..... I have not tested it so you may need to edit it.

Global $Informationencount = IniRead(@ScriptDir & "\ini-Dateien\informationen.ini", "Informationen", "Informationencount")

Global $Informationennewcount

#Region Informationen sichern
Func Sichern3()
If Not FileExists(@ScriptDir & "\ini-Dateien") Then
    DirCreate(@ScriptDir & "\ini-Dateien")
    IniWrite(@ScriptDir & "\ini-Dateien\informationen.ini", "Informationen", "Informationencount", 0)
EndIf
If FileExists(@ScriptDir & "\ini-Dateien") Then
    IniWrite(@ScriptDir & "\ini-Dateien\informationen.ini", "Informationen", "Informationen"&$Informationencount , GUICtrlRead($input39))
$Informationennewcount = IniRead(@ScriptDir & "\ini-Dateien\informationen.ini", "Informationen", "Informationencount") + 1
IniWrite(@ScriptDir & "\ini-Dateien\informationen.ini", "Informationen", "Informationencount",$Informationennewcount )

EndIf
EndFunc ;==>Sichern3

.

Link to comment
Share on other sites

@quick_sliver007:

Thank you for your help, but it doesn't work. If I start the program at a second time, te field shows me the first line and not the others and this is the input in the ini-file:

[informationen]

Informationen=Zeile1

Zeile2

Zeile3

Informationencount=2

Informationen1=Zeile 1

Zeile 2

Zeile 3

Link to comment
Share on other sites

@quick_sliver007:

Thank you for your help, but it doesn't work. If I start the program at a second time, te field shows me the first line and not the others and this is the input in the ini-file:

[informationen]

Informationen=Zeile1

Zeile2

Zeile3

Informationencount=2

Informationen1=Zeile 1

Zeile 2

Zeile 3

<{POST_SNAPBACK}>

On Exit IniWrite Informationencount to 0 so that it resets it for the next you open your script.

.

Link to comment
Share on other sites

@quick_sliver007 What do you mean?

<{POST_SNAPBACK}>

case $msg = -3
IniWrite(@ScriptDir & "\ini-Dateien\informationen.ini", "Informationen", "Informationencount", 0)
Exitloop

If I am getting you right. You want it to start over at start up and not to go on from where it was last at close. Add this line in the while 1 statement and it will reset the vaule of $Informationencount at close so that it just writes over the old stuff from the last time you had the program open.

.

Link to comment
Share on other sites

$i = 1
While 1
   $i = $i + 1
   IniWrite(@ScriptDir & "\ini-Dateien\informationen.ini", "Informationen" & $i, "Informationencount", 0)
Wend

that will add a new section each time ... all i can think of atm

Edited by burrup

qq

Link to comment
Share on other sites

At the beginning of my program is the following Code:

#Region Einlesen der Ini Datei --> informationen.ini & logbuch.ini
$file39 = IniRead(@ScriptDir & "\ini-Dateien\informationen.ini", 'Informationen', 'Informationen', '')
$file42 = IniRead(@ScriptDir & "\ini-Dateien\logbuch.ini", 'Logbuch', 'Logbuch', '')
#EndRegion Einlesen der Ini Datei --> informationen.ini & logbuch.ini

In the GUI is the following Code:

GUICtrlCreateGroup("Informationen / Logbuch", -860, -615, 910, 630)
GUICtrlCreateGroup("Informationen", 15, 25, 870, 290)
$input39 = GUICtrlCreateEdit($file39, 15, 25, 760, 240)
GUICtrlSetData($input39, $file39)
$ButtonSichern3 = GUICtrlCreateButton("Sichern", 780, 100)
GUICtrlSetOnEvent(-1, "Sichern3")

And the Func is the following:

#Region Informationen sichern
Func Sichern3()
If Not FileExists(@ScriptDir & "\ini-Dateien") Then
    DirCreate(@ScriptDir & "\ini-Dateien")
EndIf
If FileExists(@ScriptDir & "\ini-Dateien") Then
    IniWrite(@ScriptDir & "\ini-Dateien\informationen.ini", "Informationen", "Informationen", GUICtrlRead($input39))
EndIf
EndFunc
#EndRegion Informationen sichern

And now, I tell you what I want:

If somebody write more lines in the "GUICtrlCreateEdit" - Field, all lines should be saved to the ini-file. And if I start the program at a second time, the saved ini-file should be read out and all lines should be displayed int the "GUICtrlCreateEdit" field. I hope you understand my question!

Link to comment
Share on other sites

seems we had some problems bridging the language barrier lol ... wat u want to do is really quite simple ...

change your function code to this

Func Sichern3()
If Not FileExists(@ScriptDir & "\ini-Dateien") Then
    DirCreate(@ScriptDir & "\ini-Dateien")
EndIf
If FileExists(@ScriptDir & "\ini-Dateien") Then
    IniWrite(@ScriptDir & "\ini-Dateien\informationen.ini", "Informationen", "Informationen", $file39 & " " & GUICtrlRead($input39))
EndIf
EndFunc

i havent tested but it should work

qq

Link to comment
Share on other sites

At the beginning of my program is the following Code:

#Region Einlesen der Ini Datei --> informationen.ini & logbuch.ini
$file39 = IniRead(@ScriptDir & "\ini-Dateien\informationen.ini", 'Informationen', 'Informationen', '')
$file42 = IniRead(@ScriptDir & "\ini-Dateien\logbuch.ini", 'Logbuch', 'Logbuch', '')
#EndRegion Einlesen der Ini Datei --> informationen.ini & logbuch.ini

In the GUI is the following Code:

GUICtrlCreateGroup("Informationen / Logbuch", -860, -615, 910, 630)
GUICtrlCreateGroup("Informationen", 15, 25, 870, 290)
$input39 = GUICtrlCreateEdit($file39, 15, 25, 760, 240)
GUICtrlSetData($input39, $file39)
$ButtonSichern3 = GUICtrlCreateButton("Sichern", 780, 100)
GUICtrlSetOnEvent(-1, "Sichern3")

And the Func is the following:

#Region Informationen sichern
Func Sichern3()
If Not FileExists(@ScriptDir & "\ini-Dateien") Then
    DirCreate(@ScriptDir & "\ini-Dateien")
EndIf
If FileExists(@ScriptDir & "\ini-Dateien") Then
    IniWrite(@ScriptDir & "\ini-Dateien\informationen.ini", "Informationen", "Informationen", GUICtrlRead($input39))
EndIf
EndFunc
#EndRegion Informationen sichern

And now, I tell you what I want:

If somebody write more lines in the "GUICtrlCreateEdit" - Field, all lines should be saved to the ini-file. And if I start the program at a second time, the saved ini-file should be read out and all lines should be displayed int the "GUICtrlCreateEdit" field. I hope you understand my question!

<{POST_SNAPBACK}>

try this in the function

#Region Informationen sichern

Func Sichern3()

If Not FileExists(@ScriptDir & "\ini-Dateien") Then

DirCreate(@ScriptDir & "\ini-Dateien")

EndIf

If FileExists(@ScriptDir & "\ini-Dateien") Then

IniWrite(@ScriptDir & "\ini-Dateien\informationen.ini", "Informationen", "Informationen", GUICtrlRead($input39)&"_"&$file39)

EndIf

EndFunc

#EndRegion Informationen sichern

I made it so it rewrites what is in the INI file and connects the input to it.

I hope this works.

.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...