Jump to content

How to insert sections in ini-files?


Berti
 Share

Recommended Posts

Hi,

I've a lot of different textfiles, which looks like ini-file. (main.cfg). In this main.cfgs are a lot of sections ([sectionA.0], [section A.1], ..., [sectionB.0] and so on). Each main.cfg has one ore more A-sections.

I want to add one ore more (up to 10) new A-sections after the last A-section in the main.cfg. The new A-sections should contain the same keys (with different values of course) as the existing A-section.

So I think I've to count the A-sections first (should be no problem). But what to do then? Copy and rename the last A-section (I don't know how)? Create a new A-section? How can I insert the keys then?

Or is it better (easier) to create a second file with the A-sections prepared to insert? Nevertheless, they must be renamed because I don't know how many A-sections are in the main.cfg.

Thnx for help

Berti

Link to comment
Share on other sites

Look at the help files.....

Writes a value to a standard format .ini file.

IniWrite ( "filename", "section", "key", "value" )

Parameters:

filename The filename of the .ini file.

section The section name in the .ini file.

key The key name in the in the .ini file.

value The value to write/change.

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

What different it make if IniWrite create the section at the end when you have:

Reads a value from a standard format .ini file.

IniRead ( "filename", "section", "key", "default" )

That will read the key not matter where the section is located....

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...