Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 30th August 2003, 11:14   #1
atsuk
Member
 
atsuk's Avatar
 
Join Date: Jun 2003
Location: Estonia
Posts: 91
Unhappy 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)
atsuk is offline   Reply With Quote
Old 30th August 2003, 11:17   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,338
See FileOpen, FileWrite and FileClose in the documentation.

There are also some examples in the Archive.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 30th August 2003, 13:38   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,216
There are also a lot of functions for text file manipulation on the NSIS Archive.

-Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 30th August 2003, 14:38   #4
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 676
is it possible to use the INI-functions on any text file (not only *.ini) ?
it might be the better way !?

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 30th August 2003, 16:49   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,216
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

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 30th August 2003, 17:07   #6
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,338
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 31st August 2003, 06:34   #7
atsuk
Member
 
atsuk's Avatar
 
Join Date: Jun 2003
Location: Estonia
Posts: 91
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 is offline   Reply With Quote
Old 31st August 2003, 06:37   #8
atsuk
Member
 
atsuk's Avatar
 
Join Date: Jun 2003
Location: Estonia
Posts: 91
ok, i just figured it out:
FileWrite $1 '"$'
FileWrite $1 'INSTDIR" is installation directory'
atsuk is offline   Reply With Quote
Old 31st August 2003, 10:13   #9
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,338
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'

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump