Old 12th February 2008, 17:44   #1
Das123
Junior Member
 
Join Date: Dec 2007
Posts: 7
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.
Das123 is offline   Reply With Quote
Old 12th February 2008, 18:47   #2
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
Would you also like fries to go, sir?

Don't forget the soft-drink!



* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 12th February 2008, 20:35   #3
Das123
Junior Member
 
Join Date: Dec 2007
Posts: 7
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 -->

PHP Code:
Function 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 
$"$STRTOFIND"
    
StrCpy $"$R9$0
    StrCmp 
$"$STRTOFIND0 End
    StrCpy $R9 
"$STRTOREPL$\r$\n"

    
End:
    
Push $0
FunctionEnd 
Das123 is offline   Reply With Quote
Old 13th February 2008, 03:01   #4
Das123
Junior Member
 
Join Date: Dec 2007
Posts: 7
Thanks Joel,

I've got it working due to the tutorial you linked in your post.
Das123 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast 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