vbscript with html form help

Christopher Casey
Christopher Casey used Ask the Experts™
on
ok i am getting closer here is what i got i made a from that has one text input box. Then the code read the input box text and adds it in the vbs code.

well thats what i want it to do. What it does is output the html file but adds [Object] where it should put the value of the text inputbox fullname.

What am i missing
<html>
<head>
<script language="vbscript">
Sub mikerun_OnClick
 
Dim objFSO, objWsh, appDataPath, pathToCopyTo, plainTextFile, plainTextFilePath, richTextFile, richTextFilePath, htmlFile, htmlFilePath
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWsh = CreateObject("WScript.Shell")
appDataPath = objWsh.ExpandEnvironmentStrings("%APPDATA%")
pathToCopyTo = appDataPath & "\Microsoft\Signatures\"
Dim TheForm
Set TheForm = Document.forms("mikeform")
 
 
 
Set strinput = TheForm.fullname
 
 
 
 
 
'And finally, the HTML signature
htmlFilePath = pathToCopyTo & "Cool.htm"
Set htmlFile = objFSO.CreateTextFile(htmlFilePath, TRUE)
htmlfile.WriteLine("<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">")
htmlfile.WriteLine("<html xmlns=""http://www.w3.org/1999/xhtml"" >")
htmlfile.WriteLine("<body>")
htmlfile.WriteLine("<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=631 style='width:473.4pt;border-collapse:collapse;mso-yfti-tbllook:1184; mso-padding-alt:0in 5.4pt 0in 5.4pt'>")
htmlfile.WriteLine("<tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;height:60.25pt'> ")
htmlfile.WriteLine("<td width=157 style='width:117.9pt;padding:0in 5.4pt 0in 5.4pt;height:60.25pt'>")
htmlfile.WriteLine("<p class=MsoNormal align=center style='margin-top:3.0pt;text-align:center'>")
htmlfile.WriteLine("<img width=115 height=74 src='mailsig-HNS_files/image001.jpg' >")
htmlfile.WriteLine("</td> <td width=474 rowspan=2 style='width:355.5pt;padding:0in 5.4pt 0in 5.4pt;height:60.25pt'> ")
htmlfile.WriteLine("<p class=MsoNormal style='margin-top:1.0pt;margin-right:0in;margin-bottom:0in;margin-left:2.15pt;margin-bottom:.0001pt'>")
htmlfile.WriteLine("<b style='mso-bidi-font-weight:normal'> <span style='font-size:11.0pt;font-family:Arial;color:#536130'>")
htmlfile.WriteLine("" & strinput & "</span></b>")
 
htmlfile.WriteLine("</body>")
htmlfile.Write("</html>")
 
End Sub
</script>
</head>
<body>
Mike
<form id="mikeform">
<input type="text" name="fullname">
 
<input type="button" name="mikerun" value="Click me" >
</form>
</body>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
This could be it:
Change:
Set strinput = TheForm.fullname

To:
Set strinput = TheForm.fullname.value
Christopher CaseySr Systems Administrator

Author

Commented:
man i was so hoping that was it. i get this error

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)
Timestamp: Wed, 22 Jul 2009 11:05:51 UTC


Message: Object required: '[string: "Testing name"]'
Line: 16
Char: 1
Code: 0
URI: file:///C:/Documents%20and%20Settings/owner/Desktop/mike.html


And it doesn't make the html file.
Christopher CaseySr Systems Administrator

Author

Commented:
i got it i have to drop the set it's not needed here.

So now it works here is the working code if any one want to use it them self.
<html>
<head>
<script language="vbscript">
Sub mikerun_OnClick
 
Dim objFSO, objWsh, appDataPath, pathToCopyTo, plainTextFile, plainTextFilePath, richTextFile, richTextFilePath, htmlFile, htmlFilePath
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWsh = CreateObject("WScript.Shell")
appDataPath = objWsh.ExpandEnvironmentStrings("%APPDATA%")
pathToCopyTo = appDataPath & "\Microsoft\Signatures\"
Dim TheForm
Set TheForm = Document.forms("mikeform")
 
 
 
strinput = TheForm.fullname.value
 
 
 
 
 
'And finally, the HTML signature
htmlFilePath = pathToCopyTo & "Cool.htm"
Set htmlFile = objFSO.CreateTextFile(htmlFilePath, TRUE)
htmlfile.WriteLine("<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">")
htmlfile.WriteLine("<html xmlns=""http://www.w3.org/1999/xhtml"" >")
htmlfile.WriteLine("<body>")
htmlfile.WriteLine("<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=631 style='width:473.4pt;border-collapse:collapse;mso-yfti-tbllook:1184; mso-padding-alt:0in 5.4pt 0in 5.4pt'>")
htmlfile.WriteLine("<tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;height:60.25pt'> ")
htmlfile.WriteLine("<td width=157 style='width:117.9pt;padding:0in 5.4pt 0in 5.4pt;height:60.25pt'>")
htmlfile.WriteLine("<p class=MsoNormal align=center style='margin-top:3.0pt;text-align:center'>")
htmlfile.WriteLine("<img width=115 height=74 src='mailsig-HNS_files/image001.jpg' >")
htmlfile.WriteLine("</td> <td width=474 rowspan=2 style='width:355.5pt;padding:0in 5.4pt 0in 5.4pt;height:60.25pt'> ")
htmlfile.WriteLine("<p class=MsoNormal style='margin-top:1.0pt;margin-right:0in;margin-bottom:0in;margin-left:2.15pt;margin-bottom:.0001pt'>")
htmlfile.WriteLine("<b style='mso-bidi-font-weight:normal'> <span style='font-size:11.0pt;font-family:Arial;color:#536130'>")
htmlfile.WriteLine("" & strinput & "</span></b>")
 
htmlfile.WriteLine("</body>")
htmlfile.Write("</html>")
 
End Sub
</script>
</head>
<body>
Mike
<form id="mikeform">
<input type="text" name="fullname">
 
<input type="button" name="mikerun" value="Click me" >
</form>
</body>

Open in new window

Christopher CaseySr Systems Administrator

Author

Commented:
All i need was other set of eyes thank you  

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial