PDA

View Full Version : Add INI Value Help



nolazabal
07-01-2003, 11:10 AM
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
07-02-2003, 09:24 AM
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.

nolazabal
07-02-2003, 11:10 AM
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

Darryl
07-02-2003, 11:44 AM
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.

nolazabal
07-02-2003, 12:00 PM
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

Darryl
07-02-2003, 01:15 PM
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.

nolazabal
07-02-2003, 01:34 PM
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

Darryl
07-08-2003, 09:50 AM
I now understand your situation. I'm happy to hear you found a resolution to your problem.