Jump to content

Recommended Posts

Posted

Hey peoples,

I want to declare some variables in an external textfile which has to be read from my compiled script.

The background is that I want to write a script for a simple file backup for our customers. Because from machine to machine the install dirs are different I want my customers to insert the dirs into a textfile where all variables I need in my script are declared.

After some testing I now know that my textfile will be completely inserted into the exe-file after compiling and because of this it's not possible to edit the variables after compiling my script.

Is there a possibility to include an external file to my script but only the way that the compiled one will use the textfile itself instead of include it into my script?

Thanks in advance.

Dennis

Posted

You are better of using INI files to do this (store varying info.). Use built in AutoIt function IniRead to read it at runtime.

Posted

Look into ini files and iniread.

make a file called "values.ini"

[programs]
Office=C:\Program Files\Microsoft Office
Firefox=C:\Program Files\Mozilla Firefox

Then in your program

$Officelocation=iniread("values.ini","programs","Office","")
$Firefoxlocation=iniread("values.ini","programs","Firefox","")

You can also use inireadSection if you wanted, but this may be easier.

Posted (edited)

Ok thanks a lot for the information.

@lordicast: I was searching in the helpfile but didn't know the keyword "fileopen".

Edit:

iniread works great, thank you!

Edited by Jass

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
×
×
  • Create New...