Archive: User input inside text file?


User input inside text file?
  Hello,

I want to use NSIS to build an installer for email stationery for a large company. I want the people within the company to be able to run the installer, fill in a few boxes (name, title, mobile etc) and then have NSIS insert this information inside the HTML file in the relevant places.

I would also like the script to check to see if they have filled in a box, and if not to remove the html line for that portion (such as if they don't have a title).

So on my dialog page I need something like:

Enter your name: [input name]
Enter your title: [input title]
Enter your mobile number: [input mobile]

Hope someone can help me.


Would you also like fries to go, sir?

Don't forget the soft-drink!

:rolleyes: :D


Lol!

I actually have most of the script but I don't know how to effectively use dialog boxes.

The process I was going to use was to load the raw script onto the drive and then have a custom page at the end that edits the loaded html file. The html file was going to have a comment in the relevant places. Eg. <!-- name -->


writeOutput


StrCpy $STRTOFIND "<!-- Name -->"
StrCpy $STRTOREPL "<strong>Person's name</strong>"
${LineFind} "$INSTDIR\stationery.html" "$INSTDIR\stationery.html" "1:-1" "LineFindCallback"
IfErrors 0 +2
MessageBox MB_OK
|MB_ICONEXCLAMATION "The file cannot be found and so will not be updated."

>FunctionEnd

>Function LineFindCallback

StrLen$0 "$STRTOFIND"
StrCpy $1 "$R9" $0
StrCmp$1 "$STRTOFIND" 0 End
StrCpy $R9 "$STRTOREPL$\r$\n"

End:
Push $0
FunctionEnd
>

Thanks Joel,

I've got it working due to the tutorial you linked in your post. :)