atsuk
30th August 2003 12:14 UTC
How to write variable to txt or bat file
i would like to write some text and variables into a txt file.. so how to create file myfile.txt and write tekst ('my text') + variable(for example $INSTDIR) to file?? i know that it is possibel to write to ini, but i really need txt(or bat file)
kichik
30th August 2003 12:17 UTC
See FileOpen, FileWrite and FileClose in the documentation.
There are also some examples in the Archive.
Afrow UK
30th August 2003 14:38 UTC
There are also a lot of functions for text file manipulation on the NSIS Archive.
-Stu
Brummelchen
30th August 2003 15:38 UTC
is it possible to use the INI-functions on any text file (not only *.ini) ?
it might be the better way !?
Afrow UK
30th August 2003 17:49 UTC
Yes it is, you can make ini entries in not just .ini files.
You can also write $\r$\n to the end of the ini value to make a few nice gaps between entries or entry groups too hence while making logs.
-Stu
kichik
30th August 2003 18:07 UTC
I wouldn't use it. You can never know what the function will do with the data that's not structured as an INI file.
atsuk
31st August 2003 07:34 UTC
tnx :) it works, but it is strange, that in NSIS you can unite variable and string this strange way(without '+' or smth like that):
FileWrite $1 '"$INSTDIR" is installation directory'
output: "c:\program files" is installation directory
it is fine to me, but what if i wanted to get this output:
output2: "$INSTDIR" is installation directory
(right now i don't need this output, but i was just wondering)
anyway tnx again
atsuk
31st August 2003 07:37 UTC
ok, i just figured it out:
FileWrite $1 '"$'
FileWrite $1 'INSTDIR" is installation directory'
kichik
31st August 2003 11:13 UTC
The proper way to get NSIS to not process the dollar sign is to use two dollars. For example:
FileWrite $1 '"$$INSTDIR" is installation directory'