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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

running script from a text stream?

Status
Not open for further replies.

nicklieb

Programmer
Oct 17, 2002
383
GB
I have a short script that reads a file and renders it a format that is print ready.

I have on slight problem.. Within the original asp script the area of display text uses a function to pull a random image from a bank of images.

when rendering in print version the function get displayed as text, which is viewable on screen.

Is there a way to run a piece of code from a text stream, i have run a google and nothing has really turned.

If I can't then I want to remove the random image completely, however because of the script delimiters the print page bombs out, when i try to replace it with nothing


below is the img tag that I would like to either render or strip out


<img src="<%= RandomImage("") %>" alt="Random Image" align="<%= random_leftright()%>" hspace="10" vspace="10">


cheers

Nick
 
<img src="<%= RandomImage("") %>" alt="Random Image" align="<%= random_leftright()%>" hspace="10" vspace="10">

must display as image, how are u loading the file? are u calling the txt file or writing it to a html file???

stripping it out can also be done using RegExp...

Known is handfull, Unknown is worldfull
 
i am using a regular expression with fso to pull out the text between 2 defined limits.

the stripped out text is then displayed in html on screen and once printed will be closed. it is not writing to any files.
 
did u do a view source of the generated html file???

Known is handfull, Unknown is worldfull
 
yes it renders the script as html as follows:

Code:
<html>
<head>
<meta name="GENERATOR" Content="Microsoft Visual Studio.NET 7.0">
</head>
<link rel="stylesheet" href="../general.css">
<body>
<img src="images/crc_newhor_mono.gif">
<p><img src="<%= RandomImage("")	 %>" alt="Random Image" align="<%= random_leftright()%>" hspace="10" vspace="10">
some random text goes here</p>
<p>
Working for some of the world's largest brands in the mobile communications, information technology and home gateway markets, we are quoted on the Alternative Investment Market of the London Stock Exchange (AIM). 
</p>
<p>
some random text.</p>
</body>
</html>
 
if you can parse out the asp code seperately you could use execute() to run the inline code

Code:
execute("response.write  RandomImage(" & chr(34) & chr(34) & ")")

should work I think.


Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
ok.. I managed a work around by moving things around and not including the image in the print version of the web page.

thanks for all the help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top