m00 Posted September 5, 2008 Posted September 5, 2008 Aloha, I am having some trouble getting this to work: I have a multiple line Input box that is exported to an .ini file. When I open the ini file, it has all of the information, in the correct section, with the correct key, but when I try to read it out of the ini file, it only returns the first line of that key. I suspect that it is a formatting issue; I may need to manipulate the text being sent to the ini file so that it fits on one line (lf or cr or something), but I am not sure if that is right, and if it is, I am not sure how to do it. Here is some snippet of what I currently have going. $sample_input = GUICtrlCreateInput("blah",5,500,150,90, $ES_WANTRETURN + $ES_MULTILINE) $inputbutt = GUICtrlCreateButton("Ok", 5, 652, 60, 20) ;---------------------- While 1 $msg1 = GUIGetMsg() If $msg1 = $inputbutt Then IniDelete("flamingo_opt.ini","Input1 Test") IniWrite("flamingo_opt.ini","Input1 Test","1",GuiCtrlRead($sample_input)) ;msgbox(4096,"title",guictrlread($sample_input)) $var = IniReadSection("flamingo_opt.ini", "Input1 Test") For $testi = 1 To $var[0][0] MsgBox(4096, "", "Key: " & $var[$testi][0] & @CRLF & "Value: " & $var[$testi][1]) Next
DaRam Posted September 5, 2008 Posted September 5, 2008 New Line is the terminator for the key value, so it is truncating there when reading back. There is also around 255 character limit. A suggestion is to replace the new line character with a pipe (|) or other character before writing and do the reverse when reading back.
m00 Posted September 5, 2008 Author Posted September 5, 2008 New Line is the terminator for the key value, so it is truncating there when reading back.There is also around 255 character limit.A suggestion is to replace the new line character with a pipe (|) or other character before writing and do the reverse when reading back.OK, I thought that may be the case with the new line ending a key value.What has the 255 char limit? The ini value?Replacing the new line char with a pipe sounds great, but I don't know how to do it. I can't find documentation on what a multiple line input box does to text and/or don't quite understand how to add/swap a character instead of a new line.
DaRam Posted September 5, 2008 Posted September 5, 2008 OK, I thought that may be the case with the new line ending a key value. What has the 255 char limit? The ini value? Replacing the new line char with a pipe sounds great, but I don't know how to do it. I can't find documentation on what a multiple line input box does to text and/or don't quite understand how to add/swap a character instead of a new line.Yes the value. Has to do with the buffer size used when calling the "GetPrivateProfileString" Windows API. Before Writing to INI:StringReplace(contents_of_input_box, @CRLF, "|") After Reading:StringReplace(text_read_from_ini_file, "|", @CRLF)
m00 Posted September 5, 2008 Author Posted September 5, 2008 Works great. I appreciate the help. Now I just have to consider things that may/will go over the 255 char limit.
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