Archive: Tidying up your ini files


Tidying up your ini files
This may be an odd request but i was wondering if it was possible to sort my ini file sections into a specified order.

Basically i have an ini file on a network drive which all of my terminals write to. There is a section for each terminal with their pc setting stored in it. I want the ability to sort sections i specify (i.e only the PC sections) into preferably a custom order.

example :

[GENERAL]
WORKGROUP=Catalyst

[PC1]
Description=James
LPT1=HP LaserJet 6L
OS=Microsoft Windows 98
IP Address=192.168.1.1
LPT2=HP Deskjet 640

[PC2]
Description=James
IP Address=192.168.1.2
OS=Microsoft Windows 98
LPT1=HP LaserJet 2200

should appear :

[GENERAL]
WORKGROUP=Catalyst

[PC1]
Description=James
OS=Microsoft Windows 98
IP Address=192.168.1.1
LPT1=HP LaserJet 6L
LPT2=HP Deskjet 640

[PC2]
Description=James
OS=Microsoft Windows 98
IP Address=192.168.1.2
LPT1=HP LaserJet 2200

Anybody know of anyway of doing this? I mean is there a way of inserting a line into the INI file instead of it just adding to the bottom of the section.

Thanx


As far as I know the only way to do it is with FileRead/Write and friends. And it won't be simple. Quick sort in NSIS, ROFL :D