Add INI Value Help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • nolazabal
    Forum Member
    • Jul 2003
    • 8

    Add INI Value Help



    I notice that there is not Add ini setting, the only setting we have is “Set Value”, my problem is that if I need to add a Value data where the Value name already exist what the system does is modify the current Value data and do not add a new one

    Here is an example of what I mean

    [SECTION A]
    Values=A

    In this sample if I want to add a Value=B to look something like this:

    [SECTION A]
    Values=A
    Values=B

    I have not find a way to do that, can someone pls help me on this?

    Thank you
  • Darryl
    Indigo Rose Staff Member
    • Jul 2001
    • 1908

    #2
    Re: Add INI Value Help

    INI files in general were designed to have one unique "Value" per section, therefore it wouldn't really work having two identical values.

    If your goal is to add information to an existing value, what you could do is read in the value to a variable, then use an Assign Value action with the "+" operator (for string addition) between the two strings. You can then write back the modified value to the INI file.

    Hope that helps.

    Comment

    • nolazabal
      Forum Member
      • Jul 2003
      • 8

      #3
      Re: Add INI Value Help

      Sry i may me doing somthing stupid here

      this is what i have now:

      Set Value
      %InstalledPath%\test.ini
      SECTION A
      Values
      A+Values=B

      but it what add to my ini file is somthing like this
      [SECTION A]
      Values=A + Values=B

      i tried the + with quotes and without but the same

      thank you

      Comment

      • Darryl
        Indigo Rose Staff Member
        • Jul 2001
        • 1908

        #4
        Re: Add INI Value Help

        Let's say you have a value in your INI file called "myvalue". Now let's say you have the string "A" inside of the variable %MyVar% and a string "B" that you want to concatentate.

        Once you have read the "A" string into the variable %MyVar%, you would then use an Assign Value action that looks like the following to concatenate them together:

        Variable Name:
        %TwoStrings%

        Value:
        %MyVar% + "B"

        Evaluate value as expression: checkbox checked.

        The value that will be stored in the variable %TwoStrings% is "AB". You can therefore use the variable %TwoStrings% when you write it out to your INI file.

        Hope that clears things up for you.

        Comment

        • nolazabal
          Forum Member
          • Jul 2003
          • 8

          #5
          Re: Add INI Value Help

          ok that works ok, but what i want to do is add it to the ini file in 2 separate lines somthing like this
          SECTION A]
          Values=A
          Values=B

          if i do it with the "+" operator i will end with somthing like this
          SECTION A]
          Values=AB

          Comment

          • Darryl
            Indigo Rose Staff Member
            • Jul 2001
            • 1908

            #6
            Re: Add INI Value Help

            In my first post, I mentioned that having two identical values in an INI file should never be used in general. Each value should be unique otherwise if you try to access that value, there is no way to know which one is the intended target.

            Comment

            • nolazabal
              Forum Member
              • Jul 2003
              • 8

              #7
              Re: Add INI Value Help

              thank you, i end doing it with txt file functions, i agree this should never be used but i'm installing a componet to an application that has the ini settings like that so there is no much i can do

              thanks for all the help

              Comment

              • Darryl
                Indigo Rose Staff Member
                • Jul 2001
                • 1908

                #8
                Re: Add INI Value Help

                I now understand your situation. I'm happy to hear you found a resolution to your problem.

                Comment

                Working...
                X