Archive: Help! Writing to files from a Message Box


Help! Writing to files from a Message Box
I am creating an installer that will write to a text file with the results from a message box.

I have an INF file that I am installing. However one line must be changed on each install to reflect a model number provided by the user upon installation.

I have broken the file into two parts:

file1.dat (the portion before the edited line)
file2.dat (the portion following the edited line)

I want the message box to request that the user enter a model number. Then I want to store that information so that I can write it to a file later in the form:

model=user info here

Finally I would like to add the contents of the first dat file, then the line we created above, and finally the contents of the second dat file to create one INF file. All of the files mentioned can be treated as standard text files.

Is there a way to do this?

Any help is appreciated.


See the text file manipulation section on the NSIS archive:

http://nsis.sourceforge.net/archive/...instances=0,11

For
model=user info here
use WriteINIStr
which will write e.g.
[model]
model=user info here

-Stu


Sry I'm a newbie.

I understand what you are saying to write to the file.

But how can I create a message box (or some sort of text input) in the installer so that the user can enter the value to be used?


You need to make a custom page using InstallOptions.
See Contrib\InstallOptions\Reamde.html for documentation.

-Stu


Okay now I can create the INI file to display the prompt screen and I can type the returned information to my INF file.

Still stuck though.

How do I instruct my installer to load the INI file, and how do I call the return from the prompt (assign it to a variable for example)?


Maybe these questions are answered in the documentation, but I must be missing something.

Thanks for the help so far.

Also, is there a way to determine the dimensions of the installer window from within the script so that I can center my prompt in the window?


The examples in Contrib\InstallOptions\test.nsi and Examples\Modern UI\InstallOptions.nsi show you how to show the page, and read the user input.


Sorry. I found the info on how to implement the INI file and how to call up the returned value in my script in the Install Options documentation.

I'm assuming that the InstallOptions dll will also have to be included in the installer.

Thanks for all your help.

:)


Once you use a line such as:

InstallOptions::show

NSIS automatically includes the plug-in into the installer.


Thanks
Thanks for all the help. I think I can probably figure it out now.

I appreciate it.

:)


No problem.

-Stu