Archive: Newbie: Needs Help with Text to File + Registation Email


Newbie: Needs Help with Text to File + Registation Email
Hi i'm back, My installer is now reaching the end of its completion. By it's not there yet. I am trying to build a Registation page that will put a copy of all the fields Entered into a "Regstation.Txt" file in the programs "$INSTDIR". The other thing that is causing me the even more trouble is trying to figure out how to get the Regstation information to Email its self to my email account. Please Help.

:( I know this is a lot to ask but i wouldn't ask unless there was no other way. Tank you.

Please Note that when this Project reaches its completion. I will be putting a large sample of its .nsi with all it Functions and a few of my files up for grabs in the http://nsis.sourceforge.net/nsisarchive/
with full credit to all who help(ed).

Here is a very small sample what i have so far on the Regstation Page.

;Text to File - Registation Page
!include "MUI.nsh"
;Name and file
Name "Text to File"
OutFile "Text.exe"
;Default installation folder
InstallDir "$PROGRAMFILES\Text in Here"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Text in Here" ""

Page custom Regstation
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

Section "Dummy Section" SecDummy
SectionEnd
;--------------------------------
;Installer Functions
Function .onInit
InitPluginsDir
File /oname=$PLUGINSDIR\Text.ini "Text.ini"
;Extract InstallOptions INI files
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "RegistrationDialog.ini"
FunctionEnd
Function Regstation
InstallOptions::dialog "$PLUGINSDIR\Text.ini"
FunctionEnd

;-----------------------
HERE IS THE: Text.ini
;-----------------------
[Settings]
NumFields=10
Title=Registion Page

[Field 1]
Type=Label
Text=*First Name*
Left=0
Right=90
Top=0
Bottom=9

[Field 2]
Type=Text
Text=First name
Left=0
Right=103
Top=9
Bottom=22

[Field 3]
Type=Label
Text=*E-Mail*
Left=1
Right=25
Top=25
Bottom=33

[Field 4]
Type=Text
Text=E-Mail
Left=0
Right=103
Top=33
Bottom=46

[Field 5]
Type=Groupbox
Text=O/S
Left=112
Right=162
Top=11
Bottom=46

[Field 6]
Type=RadioButton
Text=Unknown
Flags=GROUP
State=1
Left=118
Right=160
Top=20
Bottom=27

[Field 7]
Type=RadioButton
Text=WinXP
Left=118
Right=152
Top=27
Bottom=35

[Field 8]
Type=RadioButton
Text=Other
Left=118
Right=152
Top=35
Bottom=43

[Field 9]
Type=Label
Text=Yes, I would like to get updates by E-Mail
Left=25
Right=200
Top=62
Bottom=102

[Field 10]
Type=Checkbox
State=1
Left=11
Right=21
Top=62
Bottom=72


You cannot easily force the user's computer to silently send you an email. If that were possible, then that would leed to people getting hold of people's private data etc and that would/could be illegal.

You can however, do

ExecShell "" "mailto:your.email&website.com?subject=$title&body=$text"

Not sure if this will work with all E-mail client programs, but it works with Outlook/Outlook Express.

To get hold of all the entered data, use ReadINIStr $var "IOfile.ini" "Field X" "State"
To collect it all into the your $text variable, use StrCpy $text "$var1<html stuff>$var2 etc"

Remember if you are using the method that I suggested, you need to send HTML to the E-mail's body, not just pure text with new line breakes ($\r$\n == <br />).

Also, my examples use $text, $var, $var1 etc for variables. These have to be defined first, or you should just use the readily defined ones ($0-9, $R0-9)

-Stu

Not sure if this will work with all E-mail client programs, but it works with Outlook/Outlook Express.
Remember that Internet Explorer has an option to choose what program to open for e-mails.

:) Thank you for your help. I will try what you have suggested and let you know how it works out. Theres just one thing Im not sure of, How do you send an HTML to the E-mail's body. Could you give me a sample of how "all" this should look?:confused: It would realy help. I am So lost. Thanks.


You would be better off to hit a website and pass the information you need in through query strings to a script that can then take some action based on the values that are passed to it.

Personally i think it would be best to use the download plugin so you can verify (by receiving a .ini file for instance and parsing it) if the script received the information correctly.


Thank you for your help, but i am still very lost :confused:. The (ExecShell "" "mailto:your.email&subject=$title&body=$text") works ok but I am not sure how to use the "$title" or "$text" variables. And the (ReadINIStr $var "IOfile.ini" "Field X" "State") is not working for me, I think I have things mixed up.

If you could wright a sample of how this needs to look it would Realy Realy Help. Thanks

Also is there a way to make the "Next>" buttion only on the custom page say Register and have it launch the "ExecShell"


Besides the legal issues perhaps BLAT can help you. It's an open source command line email sender. http://blat.sf.net


Thanks for BLAT it will hopefully be a big help. But I am still in Confusion with (ReadINIStr $var "IOfile.ini" "Field X" "State") the ($text) variables, and the (StrCpy $text "$var1<html stuff>$var2).

I really need to see an example or two, this part is killing me. every thing I have tried has failed. Please help.


Thank you for all your help, i have my Registation page almost done. the only thing that I still cant figure out is how to get BLAT to work. all the information is in a text file, I just need to get that text file to email its self to me using Blat or some other program during the installation. Please Help. Examples would be helpful. Thanks


If it's an exe, you need to Exec it or, nsExec::Exec.

You will need too extract it to a temp folder, so...

Function .onInit
InitPluginsDir
FunctionEnd
Section
SetOutPath $PLUGINSDIR
File "blat.exe"
File ...other blat files...
nsExec::Exec "$PLUGINSDIR\blat.exe -options"
SectionEnd

Thank that helped

only I used (nsExec::ExecToLog) it hides the window.
nsExec::ExecToLog "C:\blat.exe - a command"

Thanks a lot everything.:)

the only thing that i need to do now is figure out how to put a check box on the WELCOMEPAGE that will skip a page if checked [NOTE] I know how to skip pages, i just dont know how to put a check box on only the WELCOMEPAGE


nsExec::ExecToLog should be used only on the InstFiles page. It grabs the output and prints it into the details window. You should use nsExec::Exec.

-Stu


Thanks but nsExec::ExecToLog works like ExecWait and if placed in the right spot like a Function, does not print on the InstFiles page. Tanks for your help.

I Do have two more questions in:
;--------------------------------
Function .onVerifyInstDir
IfFileExists "$INSTDIR" PathGood
MessageBox MB_YESNO|MB_TOPMOST " Are you sure you whant to install here. \
$\r$\n$\r$\nIf you choose install here the some things will not work. IDYES PathGood IDNO installold
installold:
MessageBox MB_YESNO|MB_TOPMOST "${APPNAME} Installation must be restarted to restore destination Folder $\n Restart Now? " \
IDNO PathGood IDYES
Quit ;Abort
PathGood:
FunctionEnd
;------------------------------
How do you reset the "$INSTDIR" so that you do not have to restart the app?

And in a text box how do make it tab over to the next box if more than one "word" is used, but only tab over in that one box and not the others. And is it possible to make the first letter in thows that one box automaticly swich to a capital while the fallowing letters are lower case
Thank you for your time and help.