Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > VBScript
|
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 6th, 2005, 03:44 AM
Registered User
 
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default add messages to textarea on the fly in vbs

I've searched this forum and found some solutions that came close but where not exactly what I am trying to do. I've got a vbscript that performs several functions and uses an IE window to display a status window. This IE window contains a textarea to display messages as each function is completed.

To update the textarea, I read everything into a variable, add my new message to it, and write it back to the textarea.

The problem I am having is that I cannot insert VBCRLF or <BR> between each message to place each of them on a new line. All of the messages run together and only get word wrapped.

Here are a few sections from the script:
Set oIE = WScript.CreateObject("InternetExplorer.Application ", "oIE_")
With oIE : .left = 100 : .top = 80 : .width = 500 : .height = 160
    .menubar = False : .toolbar = False : .statusbar = False : End With
Set oDoc = oIE.document
With oDoc 'fill in the (ie) dialog, with a message and progbar
    .Open
    .WriteLn ("<html><head><title>" & sCaption & "</title></head> ")
    .WriteLn ("<body bgcolor='Silver' leftmargin=15 topmargin=5 scroll='no' > ")
    .WriteLn ("<textarea id=txtBox rows=3 cols=50>")
    .WriteLn ("")
    .Close End With ' oDoc

Sub WriteToProgBar(NewMsg)
'add text to the textarea and scroll to the bottom
temp = oDoc.getElementById("txtBox").innerHTML
oDoc.getElementById("txtBox").innerHTML = temp & vbcrlf & NewMsg
oDoc.getElementById("txtBox").scrollTop =
oDoc.getElementById("txtBox").scrollheight
End Sub

Any help on this would be greatly appreciated,

Rich



Reply With Quote
  #2 (permalink)  
Old January 6th, 2005, 08:22 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Hi,

   I may be wrong here, but HTML will take the line back from a null insert. Maybe this line:

.WriteLn ("")

Should be this:

.WriteLn (" ")

Just insert some spaces like I do when formatting tables since if I don't put a space in a cell, the page take the row back.

I hope that works for you.


mmcdonal
Reply With Quote
  #3 (permalink)  
Old January 6th, 2005, 03:47 PM
Registered User
 
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Sorry, that was a typo. That line was supposed to read: .WriteLn ("</body></html>").
The problem I am having is in the WriteToProgBar sub. It will not display the carriage returns in the textare so that all of the text is running together.

Any help would be greatly appreciated,

Rich



Quote:
quote:Originally posted by quantum1976
 I've searched this forum and found some solutions that came close but where not exactly what I am trying to do. I've got a vbscript that performs several functions and uses an IE window to display a status window. This IE window contains a textarea to display messages as each function is completed.

To update the textarea, I read everything into a variable, add my new message to it, and write it back to the textarea.

The problem I am having is that I cannot insert VBCRLF or <BR> between each message to place each of them on a new line. All of the messages run together and only get word wrapped.

Here are a few sections from the script:
Set oIE = WScript.CreateObject("InternetExplorer.Application ", "oIE_")
With oIE : .left = 100 : .top = 80 : .width = 500 : .height = 160
    .menubar = False : .toolbar = False : .statusbar = False : End With
Set oDoc = oIE.document
With oDoc 'fill in the (ie) dialog, with a message and progbar
    .Open
    .WriteLn ("<html><head><title>" & sCaption & "</title></head> ")
    .WriteLn ("<body bgcolor='Silver' leftmargin=15 topmargin=5 scroll='no' > ")
    .WriteLn ("<textarea id=txtBox rows=3 cols=50>")
    .WriteLn ("")
    .Close End With ' oDoc

Sub WriteToProgBar(NewMsg)
'add text to the textarea and scroll to the bottom
temp = oDoc.getElementById("txtBox").innerHTML
oDoc.getElementById("txtBox").innerHTML = temp & vbcrlf & NewMsg
oDoc.getElementById("txtBox").scrollTop =
oDoc.getElementById("txtBox").scrollheight
End Sub

Any help on this would be greatly appreciated,

Rich



Reply With Quote
  #4 (permalink)  
Old January 31st, 2005, 10:08 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Then how about:

.WriteLn("</p>")

or

.WriteLn("<br>")

???

mmcdonal
Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
creating textfield on the fly Acod Classic ASP Professional 1 April 25th, 2007 09:22 AM
Tab function + <textarea></textarea> Adam H-W HTML Code Clinic 0 April 24th, 2007 10:36 AM
Excel on the fly tjse7en Classic ASP Basics 1 September 23rd, 2005 06:18 AM
Crystal Report on the Fly with C# spaceodyssey Crystal Reports 0 July 13th, 2004 05:01 AM
display vbCrLf's from textarea to textarea mat41 Classic ASP Basics 8 June 10th, 2004 12:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.