Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create & Display HTML in IE automaticall from Array Contents

Status
Not open for further replies.

Neily

Programmer
Jul 27, 2000
342
GB
I have created a script that reads values in from a text file and then puts it into an array with HTML tags. What I want to do is to have this load automatically after the script has run and display the HTML in IE in a certain place in an HTML Template file I have produced. Any ideas???
 
Do you want to add it into a file? Or create a new file? If it's adding, would it be added to the end of the code, or is there a breaking point in the middle? Either way, I would suggest takeing the html "template" file, and writing the portion you need into a temp file, you can put a breaking point in there...eg.

dim TempString
dim InputString as string
dim InputBuf() as byte
dim BreakPoint as string
dim InsertPoint as integer
dim MyLoop as integer

MyLoop = 0
BreakPoint = &quot;<!-- Insert --!>&quot;

open &quot;template.html&quot; for input as #1
do while <> EOF(1)
input #1, TempString
InputString = InputString + TempString
loop
close(1)

InputBuf = StrConv(InputString & chr$(0), vbFromUnicode)
InsertPoint = InStr(0, InputString, BreakPoint)

open &quot;Finish.html&quot; for output as #1
do while MyLoop <= InsertPoint
if (InputBuf(MyLoop) <> 0) then
write #1, chr(InputBuf(MyLoop))
end if
MyLoop = MyLoop + 1
loop
close(1)

open &quot;Finish.html&quot; for append as #1
' Do your other process here, to get the html code
' Then just write #1, programOutput or whatever
close(1)

open &quot;Finish.html&quot; for apend as #1
MyLoop = InsertPoint
do while InputBuf(MyLoop) <> 0
write #1, chr(InputBuf(MyLoop))
MyLoop = MyLoop +1
loop

Now, there may be a better way, and there may be errors in here (I just whipped it up from scratch :p) But this is basically how i'd go about it...I'm open to constructive critisizim :p

Hope it helps, regardless,
Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top