Generating an ini file with specific fields - easiest way?

Associate
Joined
20 Mar 2010
Posts
66
We use ini files in work for uploading templates to certain routers. We change specific fields in the templates depending on what IP range the customer wants, wether they want NAT/NO NAT, DHCP enabled, port forwards etc etc.

At the moment we edit the fields but this can lead to parts being missed out or simple mistakes in the form.

I want to make something that will enable us to simply fill in some text boxes asking things such as:

IP RANGE :
SUBNET MASK :
DHCP ON/OFF :
ROUTER PASSWORD :
NAT/NO NAT :
PORT FORWARDS :
ETC :
ETC :

It will then generate the form with the fields filled in. I've put part of a ini template below.

I know this must be possible but what would be the easiest way for me to achieve this?

Thanks

-------------------------------------------------------------------------------------------------------------------
[ diagnostics.ini ]
config pingtimeout=1000 pingpacketsize=32

[ dnsc.ini ]
config timeout=5 retry=4 search=enabled trace=disabled
dnsadd addr=127.0.0.1 port=53

[ dnss.ini ]
config domain=lan timeout=15 suppress=0 state=enabled trace=disabled syslog=disabled WANDownSpoofing=enabled WDSpoofedIP=198.18.1.0
host add name=dsldevice addr=0.0.0.0 ttl=1200
host add name=speedtouch addr=0.0.0.0 ttl=1200

[ dhcs.ini ]
debug traceconfig state=disabled
policy verifyfirst=enabled trustclient=enabled
pool config name=LAN_private intf=LocalNetwork poolstart=192.168.0.2 poolend=192.168.0.254 netmask=24 gateway=192.168.0.1 server=192.168.0.1 leasetime=86400

[ dhcr.ini ]
ifconfig intf=LocalNetwork relay=enabled
add addr=127.0.0.1 intf=LocalNetwork giaddr=192.168.0.1

[ dhcc.ini ]
debug traceconfig state=disabled
-------------------------------------------------------------------------------------------------------------------
 
It wouldn't take long at all to make a simple VB app that asked for settings and then wrote the ini file, but there is a simpler/dirtier way.

Using excel make a spreadsheet with the ini file in it as text with different cells for each variable so you can change them easily. You can then make the cells you want to be able to change different colours if you like. Lock the cells that you don't want to be able to change. You then simply open the spreadsheet each time, make the changes you need and then save it as a MSDOS/TEXT file with the name of the .ini you want to create. You can even do the saving bit as a macro if you like.
 
Back
Top Bottom