Announcement

Collapse
No announcement yet.

Need help to INIFile.Get|SetValue with space.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help to INIFile.Get|SetValue with space.

    Hello everyone

    I try to read an input which can contain space characters at the begining with an Ini File.

    I save the value by:

    INIFile.SetValue("C:\\Progress\\Config.ini", "Text", "Text1", sIn1); --> Where sIn1 can have space at the begining.

    My ini file is like that:



    If i read the Text1 value by:

    sTexte1 = INIFile.GetValue("C:\\Progress\\Config.ini", "Text", "Text1");

    and set to a label with:

    Label.SetText("Label1", sTexte1);

    I loose space characters before Alain.

    Does anyone have an idea for this context?

    Merci,

    Alain

  • #2
    Sorry ! My ini file:

    Click image for larger version

Name:	progress.png
Views:	85
Size:	7.9 KB
ID:	304097

    Comment


    • #3
      Hi Alain ,
      Not sure why you would need spaces on a Label as it is transparent and you would not notice unless placed with background.

      To get spaces for your string we have to get the length and save to our ini file then compare when we get our text from ini file
      Anyway here is an example I've done for you

      Text with Space.apz
      Cheers

      Comment


      • #4
        By default, leading and trailling blanks are discarded when working with INI files. You can preserve them if you put quotes around the values.
        Code:
        INIFile.SetValue(_TempFolder .. "\\sample.ini", "Test Section", "Test Value", "[B][COLOR=#FF0000]\"[/COLOR][/B]   Test Data with spaces   [COLOR=#FF0000][B]\"[/B][/COLOR]");
        local sValue = INIFile.GetValue(_TempFolder .. "\\sample.ini", "Test Section", "Test Value");
        Dialog.Message("", "[" .. sValue .. "]");
        Ulrich

        Comment


        • #5
          Sorry for my late response,

          Many thanks for your help Ulrich and charliechaps,

          The example given by charliechaps solved my problem and I thank him for that.
          I learned a lot today with the help of Ulrich as usual.

          The purpose of this is to launch a program after that certain conditions are met.( startup windows, database, etc...)

          The user can personalize the launch program ( background, time to launch the next program, text and color to display ,etc...)


          Click image for larger version

Name:	progress1.png
Views:	204
Size:	625.7 KB
ID:	304107


          After this, he save the configuration and install the program to the user computer.


          Click image for larger version

Name:	progress2.png
Views:	113
Size:	177.5 KB
ID:	304108

          At the end of the progress, the real program is launched.

          Why this: because the user is in a hurry. Actualy windows start very quick and we need about 2 mn to communicate and normalize with other systems.

          So the final user can't interact whith the sytem.
          .

          Attached Files

          Comment

          Working...
          X