Sign in to follow this  
Followers 0
enaiman

About .ini commands

3 posts in this topic

Sorry if this was asked before but ...

The way AutoIT writes ini files the entries looks like "key=1" so there are no white spaces between "key" "=" and "1".

There is a simple way to get this done so the ini content could look like "key = 1" (having spaces between)?

I'm asking this because I can't write the ini file of a TFTP server (3CDaemon) - I can write into it but what I can add there it looks like different keys (the difference being those extra white spaces) so the program won't do anything about the keys I try to add.

I could imagine a way implying some text manipulations (read content and insert characters at certain positions ... ) but this is a complicated way. This is the reason to ask for help.

If someone knows a simple way that will be wonderful. If there is no "easy way" - I'll do it.

Thanks anyway for any reply.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites



IniWrite("bleh.ini", "", "Key", " 1")

will give you key= 1 -could not figure out how to get a space after the key


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

The easiest way is:

$testFile = FileOpen("test.ini", 2)
    $string = FileRead($testFile, FileGetSize("test.ini"));read the file
FileClose($testFile)

$string = StringReplace($string, "=", " = ");replace "=" with " = "

$testFile = FileOpen("test.ini", 2)
    FileWrite($testFile, $string);overwrite to file
FileClose($testFile)

That will work, assuming that there are no "=" within the actual values. Otherwise I'd read the file line by line and use StringinStr to find the first "=" in the line and then to pop in the spaces there.


"Everything is vague to a degree you do not realize till you have tried to make it precise." - Bertrand Russell [The Philosophy of Logical Atomism]

Share this post


Link to post
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
Sign in to follow this  
Followers 0