Sign in to follow this  
Followers 0
ifthenhelpme

Not about AutoIt

25 posts in this topic

How do you make a .ini (a Configuration file) and link it to the program you want it to configure?

Share this post


Link to post
Share on other sites



ok....so is anyone gunna help me AT ALL?or are all these "brainiacs"(not offensive)out there finally stumped...the internet is no help as all the files i try to dl are humungous....

Share this post


Link to post
Share on other sites

INI-files can be changed with the IniWrite command. a simple search in the helpfile should show you everything you can do with INI-files.

But the second part...

A file cannot be linked to another file, so your question is what's wrong. Maybe there are some people out there that can read your mind and can help you. But with that little information you provide I doubt that.

Besides just waiting one hour and then complaining that you didn't receive any help is a bit strange. There are parts of the world where it's deep night just now and usually everyone is asleep.

Share this post


Link to post
Share on other sites

Umm... Duh... No offense, but an ini file is nothing more than a text file.


Who else would I be?

Share this post


Link to post
Share on other sites

well ...sorry... what i mean by linking it to another file...is directing it to which file to be able to configure...

Share this post


Link to post
Share on other sites

Depends on the program. Most windows software has a hardcoded path and filename (like windows directory, user directory or current directory) and in most cases you cannot tell the program to read a specific ini-file.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

yep.. just cause you have an .ini does not mean the program you want to read it.. will read it.

if the program has a .ini already.. you might just try editing it

what exactly are you trying to do?

we are here to help

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

black.. thats obvious if they are both able to use the same .ini

i think he meant use any program... with any .ini

which is just .... plain.... crazy


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

ok...me write script...me compile script to .exe ... me ask u guys for help making .ini file to configure certain things in the .exe "autoit script"...me rephrase question to help u guys understand...and no there obviously isnt a .ini file for the program already...btw this is an .ini file for me conditional statement script...

Thanks,

Dan

Share this post


Link to post
Share on other sites

ok...me write script...me compile script to .exe ... me ask u guys for help making .ini file to configure certain things in the .exe "autoit script"...me rephrase question to help u guys understand...and no there obviously isnt a .ini file for the program already...btw this is an .ini file for me conditional statement script...

Thanks,

Dan

<{POST_SNAPBACK}>

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

config.ini config1 myvar notfound

Contents of config.ini

[config1]

myvar = myvalue

Code to retrieve myvar's value

$readmyini = IniRead ( "config.ini", "config1", "myvar", "notfound" )
msgbox(0,"Value", "The value of myvar is " & $readmyini)

Success: Returns the requested key value.

Failure: Returns the default string if requested key not found.

A standard ini file looks like:

[sectionName]

Key=Value

Code to write value to myvar

$writevalue = InputBox ( "Value", "Enter Value" , "blah" )
IniWrite ( "config.ini", "config1", "myvar", $writevalue )

This is all straight outta the help file with very minor alteration. Have you read it?

Share this post


Link to post
Share on other sites

ok...im not exactly an expert at this...is this in the manual under IniWrite?

Share this post


Link to post
Share on other sites

okie-dokies...thanks...il figure it out eventually

Share this post


Link to post
Share on other sites

Just to confuse you a bit more, if you want multiple scripts to use the same INI, I normally store the INI location in the registry. You can also have the program read the ini file, and if it fails, you could have it write the default one.

check out RegWrite and RegRead functions in the manual.

I made a few programs for others, and the program would ask them questions on file locations the first time, and then it would store these defaults on the computer, later it would just read these and not have to ask each time. My second script I gave them read the reg entry to determine that INI and knew the file locations. I never had to worry about where they stored anything, and didn't have to use any searches.


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

@josbe - um...ive read that over and over and over trying to figure out what that means...i want the .ini file to be able to configure only a few things out of the entire script...so that means ...

Share this post


Link to post
Share on other sites

IniWrite( "Config.ini", "Settings", "Username", "JoeUser") Would write this to Config.ini

[settings]

Username=JoeUser

To read it you would do

IniRead("Config.ini", "Settings", "Username", "Not Found")

The return value would be JoeUser. And if the key, "Username" didn't exist, it would return "Not Found".


My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]

Share this post


Link to post
Share on other sites

ok so i want it to read the part

$a=is|...
$b=isn't|...

and only to be able to edit that...so what would i do?

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

What do you mean. If a .ini looks like this:

[information]

Username=JoeUser

Password=JoePass

and you wanted to change the password, you would do.

IniWrite("Config.ini", "Information", "Password", "JoePass2")

This would:

a.) If the key "Password" doesn't exist, it would write the key in with the value.

b.) If the key "Password" does exist, it would change the value to JoePass2

Edit:

A standard ini file looks like:

[sectionName]Key=Value

Edited by the_lord_mephy

My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]

Share this post


Link to post
Share on other sites

i want it to write an .ini file to configure the part on $a=is|... and $b=isn't|... and only those two...what does the command look like

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