Sign in to follow this  
Followers 0
schnikies79

Pulling Varibles From A Text File

6 posts in this topic

I have searched the forum and have been though the help files but have not come across what I'm looking for. I have 13 varibles that need to be edited by the user in a file apart from the script so they don't have to edit the script itself. Basically it's a configuration file, but each one will show up as a varible in the script. Is it possible to do this without having to open up the text file and copy/paste, compare and such? Just needing someone to point me in the right direction.

Share this post


Link to post
Share on other sites



Please post script and people may be able help you more

Share this post


Link to post
Share on other sites

I have searched the forum and have been though the help files but have not come across what I'm looking for. I have 13 varibles that need to be edited by the user in a file apart from the script so they don't have to edit the script itself. Basically it's a configuration file, but each one will show up as a varible in the script. Is it possible to do this without having to open up the text file and copy/paste, compare and such? Just needing someone to point me in the right direction.

You seem to look for something as writing in a file INI. IniRead () and IniWrite can be useful at your purposes.

Share this post


Link to post
Share on other sites

My script at the moment does nothing but cut and paste a few things then execute a batch file, which does all the work. No need to post on here yet.

Just looking for direction. Trying to learn!

Thanks for the info elgabionline.

Share this post


Link to post
Share on other sites

something like this

#include <File.au3>
_filecreate(@ScriptDir & "\config.ini")
$file = @ScriptDir & "\config.ini"
$variable = "thatsgreat2345"
FileWriteLine($file,"[config]")
Filewriteline($file,"Username=" & $variable)
$Username = Iniread($file,"config","Username","")

Share this post


Link to post
Share on other sites

_filecreate(@ScriptDir & "\config.ini")
$file = @ScriptDir & "\config.ini"
$variable = "thatsgreat2345"
FileWriteLine($file,"[config]")
Filewriteline($file,"Username=" & $variable)

Why do this extra work here, when the built in function, IniWrite() can handle all that for you?

IniWrite(@ScriptDir & "\config.ini", "config", "Username", "thatsgreat2345")

[u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia

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