Markir Posted March 7, 2005 Author Share Posted March 7, 2005 Hello Quicksilver, thank you for your help, but it doesn't work :-( Must I change the codelines to read the ini-file? #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 Link to comment Share on other sites More sharing options...
Markir Posted March 15, 2005 Author Share Posted March 15, 2005 Why does nobody help me, to solve my problem? Link to comment Share on other sites More sharing options...
Markir Posted March 17, 2005 Author Share Posted March 17, 2005 Can somebody help me, how I can write more then one line to an ini-file? Link to comment Share on other sites More sharing options...
SlimShady Posted March 17, 2005 Share Posted March 17, 2005 Can somebody help me, how I can write more then one line to an ini-file?<{POST_SNAPBACK}>Use INIWrite more than once..? You probably don't mean that. Explain what you have and what you want to accomplish. Link to comment Share on other sites More sharing options...
Markir Posted March 17, 2005 Author Share Posted March 17, 2005 @SlimShaddy: Okay: I have a "Editfield" in that the user can leave informations. If the user make a return on the end of one line, the following lines are not been displayed after starting the program a second time. I save this informations by clicking on a save button. Now I hope you can help me... Func Logbuch () $Fenster_Logbuch = GUICreate("", 640, 480 - 42, 0, 0, $WS_CHILD, -1, $Haupt_Fenster) GUICtrlCreateGroup("Logbuch", 20, 20, 600, 400) $input_logbuch = GUICtrlCreateEdit($file_logbuch, 35, 40, 570, 240) GUICtrlSetData($input_logbuch, $file_logbuch) EndFunc Func logbuch_sichern() If Not FileExists(@ScriptDir & "\ini-Dateien") Then DirCreate(@ScriptDir & "\ini-Dateien") EndIf IniWrite(@ScriptDir & "\ini-Dateien\logbuch.ini", "Logbuch", "Logbuch", GUICtrlRead($input42)) EndFunc Link to comment Share on other sites More sharing options...
SlimShady Posted March 17, 2005 Share Posted March 17, 2005 (edited) I understand now. I have done this before. This is how you save the content. $content = GUICtrlRead($input42) ;Save the content of the edit box $Save2INI_line = StringReplace(StringStripCR($content), @LF, '\#nl') ;Delete carriage returns and replace the line feeds with an unused string IniWrite(@ScriptDir & "\ini-Dateien\logbuch.ini", "Logbuch", "Logbuch", $Save2INI_line) ;Write the result to an INI file This is how you restore it again: $SavedINI_content = IniRead(@ScriptDir & "\ini-Dateien\logbuch.ini", "Logbuch", "Logbuch", "") If $SavedINI_content <> "" Then If StringInStr($SavedINI_content, '\#nl') Then $SavedINI_content = StringReplace($SavedINI_content, '\#nl', @CRLF) EndIf GUICtrlSetData($input42, $SavedINI_content) EndIf Edited March 17, 2005 by SlimShady Link to comment Share on other sites More sharing options...
Markir Posted March 18, 2005 Author Share Posted March 18, 2005 Hi, thank for helping, but I have one more problem.... GUICtrlCreateGroup("Logbuch", -795, 180, 870, 290) $input42 = GUICtrlCreateEdit($file42, 15, 25, 760, 240) GUICtrlSetData($input42, $file42) $ButtonSichern4 = GUICtrlCreateButton("Sichern", 780, 100) GUICtrlSetOnEvent(-1, "Sichern4") This is the code for the inputfield. How must I change the code, that your code works with inputfield code? Link to comment Share on other sites More sharing options...
SlimShady Posted March 18, 2005 Share Posted March 18, 2005 $SavedINI_content = IniRead(@ScriptDir & "\ini-Dateien\logbuch.ini", "Logbuch", "Logbuch", "") If $SavedINI_content <> "" Then If StringInStr($SavedINI_content, '\#nl') Then $SavedINI_content = StringReplace($SavedINI_content, '\#nl', @CRLF) EndIf EndIf GUICtrlCreateGroup("Logbuch", -795, 180, 870, 290) $input42 = GUICtrlCreateEdit($SavedINI_content, 15, 25, 760, 240) $ButtonSichern4 = GUICtrlCreateButton("Sichern", 780, 100) GUICtrlSetOnEvent(-1, "Sichern4") Link to comment Share on other sites More sharing options...
Markir Posted March 18, 2005 Author Share Posted March 18, 2005 Thanks it works very fine. Link to comment Share on other sites More sharing options...
Markir Posted March 18, 2005 Author Share Posted March 18, 2005 @SlimShaddy: Sorry that I am nerving you: But I have a problem to implement the code in my project.... There were no input in the logbuch.ini Here is the whole code as project to download, I hope you can help me a second time Thank you for everything Link to comment Share on other sites More sharing options...
SlimShady Posted March 18, 2005 Share Posted March 18, 2005 If you are going to use GUIGetMsg(), delete all instances of GUISetOnEvent and GUICtrlSetOnEvent. And put $ButtonSichern4 in the GUIGetMsg loop. Link to comment Share on other sites More sharing options...
Markir Posted March 18, 2005 Author Share Posted March 18, 2005 Now I have deactivated the Event Msg #Region Logbuch Func Logbuch () $Fenster_Logbuch = GUICreate("", 640, 480 - 42, 0, 0, $WS_CHILD, -1, $Haupt_Fenster) GUICtrlCreateGroup("Logbuch", 20, 20, 600, 400) $SavedINI_content_logbuch = IniRead(@ScriptDir & "\ini-Dateien\logbuch.ini", "Logbuch", "Logbuch", "") If $SavedINI_content_logbuch <> "" Then If StringInStr($SavedINI_content_logbuch, '\#nl') Then $SavedINI_content_logbuch = StringReplace($SavedINI_content_logbuch, '\#nl', @CRLF) EndIf EndIf $input_logbuch = GUICtrlCreateEdit($SavedINI_content_logbuch, 35, 40, 570, 240) $ButtonSichern4 = GUICtrlCreateButton("Sichern", 200, 400) ;GUICtrlSetOnEvent(-1, "logbuch_sichern") EndFunc #EndRegion Logbuch But there must I set "$ButtonSichern4"? Link to comment Share on other sites More sharing options...
SlimShady Posted March 18, 2005 Share Posted March 18, 2005 - Search for GUIGetMsg - Add a new test case with $ButtonSichern4, in the big "Select... Case" statement that executes the appropriate function Link to comment Share on other sites More sharing options...
Markir Posted March 18, 2005 Author Share Posted March 18, 2005 Okay, I have done it,but there was one error message:C:\Dokumente und Einstellungen\Marc\Desktop\Programmierung\xpr_install_menü.au3 (1295) : ==> Variable used without being declared.: $content_logbuch = GUICtrlRead($input_logbuch) ;Save the content of the edit box $content_logbuch = GUICtrlRead(^ ERROR>Exit code: 0  Time: 1.163And this is the code:Func logbuch_sichern() $content_logbuch = GUICtrlRead($input_logbuch);Save the content of the edit box $Save2INI_line_logbuch = StringReplace(StringStripCR($content_logbuch), @LF, '\#nl') ;Delete carriage returns and replace the line feeds with an unused string IniWrite(@ScriptDir & "\ini-Dateien\logbuch.ini", "Logbuch", "Logbuch", $Save2INI_line_logbuch) ;Write the result to an INI file EndFunc Link to comment Share on other sites More sharing options...
SlimShady Posted March 18, 2005 Share Posted March 18, 2005 Why ask us about the error message? Can't you solve this yourself? What are you? 12? Link to comment Share on other sites More sharing options...
Markir Posted March 18, 2005 Author Share Posted March 18, 2005 No, I am not 12, but I don't know what the mistake is???? Link to comment Share on other sites More sharing options...
Markir Posted March 20, 2005 Author Share Posted March 20, 2005 Hello, this is my code to save the logbuch with clicking on a button: Case $msg = $ButtonSichern4 Then logbuch_sichern() But it doesn'T work, there is an error message: C:\Dokumente und Einstellungen\Marc\Desktop\Programmierung\xpr_install_menü.au3 (318) : ==> Invalid keyword at the start of this line.: Link to comment Share on other sites More sharing options...
buzz44 Posted March 21, 2005 Share Posted March 21, 2005 (edited) select/case statements DONT USE "THEN" .... try this Case $msg = $ButtonSichern4 logbuch_sichern() edit: try to actually READ what the erroe says to determine the problem... as with ur above problem before, you had a SYNTAX error where you must of mistakenly written the wrong variable, in other words a spelling mistake edit2: after looking above at your other posts i have determined the problem, you are using that variable IN ANOTHER FUNCTION, you must declare the variable, at the top of your script put Global $Input_LogBuch Edited March 21, 2005 by burrup qq Link to comment Share on other sites More sharing options...
Markir Posted March 21, 2005 Author Share Posted March 21, 2005 @Burrup:Okay thank you for your help, this works:This is the result in the logbuch.ini file[Logbuch]Logbuch=Zeile1\#nlZeile2\#nlZeile3\#nlIf i start the program a second time the following code doesn't functioned....Func Logbuch() $Fenster_Logbuch = GUICreate("", 640, 480 - 42, 0, 0, $WS_CHILD, -1, $Haupt_Fenster) GUICtrlCreateGroup("Logbuch", 20, 20, 600, 400) $SavedINI_content_logbuch = IniRead(@ScriptDir & "\ini-Dateien\logbuch.ini", "Logbuch", "Logbuch", "") If $SavedINI_content_logbuch <> "" Then If StringInStr($SavedINI_content_logbuch, '\#nl') Then $SavedINI_content_logbuch = StringReplace($SavedINI_content_logbuch, '\#nl', @CRLF) EndIf EndIf $input_logbuch = GUICtrlCreateEdit($SavedINI_content_logbuch, 35, 40, 570, 240) $ButtonSichern4 = GUICtrlCreateButton("Sichern", 200, 400) EndFuncIf I start the program a second time, the input is "0"... and not Zeile1, Zeile2, Zeile3 Link to comment Share on other sites More sharing options...
SlimShady Posted March 21, 2005 Share Posted March 21, 2005 Can you please attach the script? I'm gonna have a look. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now