PDA

View Full Version : Create a File


Joel
25th April 2003, 15:12
Is it possible to create a file during installation?

For example:

Create in the $INSTDIR the dummy file "dummy.txt"
With the text "Hi, I'm a dummy" :D

Thanks :p

kichik
25th April 2003, 15:13
Use FileOpen, FileWrite and FileClose to do this. Just open a file using FileOpen, write your string into it using FileWrite and close it using FileClose.

Joel
25th April 2003, 15:43
OK.
But the files isn't in the compiled source files.
I'm going to create a new one.
Does FileOpen creates new ones?

kichik
25th April 2003, 15:44
Yes, FileOpen creates the file if it isn't there already.

Joel
25th April 2003, 15:53
thanks dude ;)

kichik
25th April 2003, 16:54
Just saw the page you've created (http://nsis.sourceforge.net/archive/viewpage.php?pageid=222) on the archive using this code. There is an easier way as can be seen in makensis.nsi:

WriteINIStr "$SMPROGRAMS\NSIS\NSIS Development Site.url" "InternetShortcut" "URL" "http://nsis.sourceforge.net/"

Afrow UK
25th April 2003, 17:26
I have a create batch function in my app.
It extracts the base file (compile.bat) which I have already crated here on my pc. That batch has keys in it like so:

<bsp_area>
<bsp_compile_area>
<vis_compile_area>
<rad_compile_area>
<copy_files_area>

I use a modified version of the replacetext function to replace these keys with the right executables (e.g. I replace <bsp_compile_area> with "$INSTDIR\quake2\compilers\qbsp3.exe $8.map" which is all set ready for an ms-dos environment.

I also use a slightly modified replacetext function which allows me to use it like so:

Push "[Text to replace]"
Push "[Replace text with this]"
Call replacetext

-Stu

Joel
26th April 2003, 14:11
Will do, KichiK ;) :up: