View Single Post
  #1 (permalink)  
Old January 6th, 2005, 03:44 AM
quantum1976 quantum1976 is offline
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