Generating an ini file with specific fields - easiest way?

IamBusby

Member
Dec 12, 2001
129
0
0
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
-------------------------------------------------------------------------------------------------------------------
 

GaryJohnson

Senior member
Jun 2, 2006
940
0
0
There's a heck of a lot of ways to do that; you could work within just about any development language. The easiest way is to write code in whatever development language you know; if you don't know a language, then VB or VBA - or PHP if you have access to a webserver running it - those languages are generally considered the easiest I think. What do you know?
 

IamBusby

Member
Dec 12, 2001
129
0
0
What do I know? I guess that's where the difficulty starts :)

I'm afraid I don't know any programming languages. I've worked with HTML but that's it.

This is why I'm after the easiest way. Not due to laziness but ignorance I'm afraid :(

Well probably laziness as well :)
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Find someone within your organization that has the programming knowledge (as indicated - any language) that can put together a quick app for you.
 

GaryJohnson

Senior member
Jun 2, 2006
940
0
0
HTML is a place to start. You could build the form you need in HTML, then you just need some client-side or server-side scripting to generate the file.
 

WannaFly

Platinum Member
Jan 14, 2003
2,811
1
0
Since you have no programming experience, with a little bit of research you can do this with a batch file or vb script. No interface needed then.

But, it looks like you might have a lot of inputs/outputs so it'd get pretty long/redundant.
 

KIAman

Diamond Member
Mar 7, 2001
3,342
23
81
There are so many ways to do this, you will first have to pick which. Unless you pick some obscure language or one that has limited IO functionality, all of them will be equally easy.

Is this in a Windows environment? You can even make a Word document form that just allows entry in specific portions of the form and save as a text file with .ini extension. You can do that in Excel as well.

Is this Unix? If you don't HAVE to have textboxes for entry and can live with command prompt entry, you can use a very simple script.

Choose something and we can move forward with your request. Unfortunately HTML by itself is inadequate, you'll have to mix some scripting in there to make the file I/O work.