PDA

View Full Version : Where are you text line!


Bruce
04-18-2004, 12:16 PM
I would like to find a spacific line in a text file, change it as needed and then turn it into a html file within AMS. The area in red is what I need to change. Any ideas?


<html>
<head>
<title></title>
<meta name="description" content="">
</head>
<body scroll="no" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#000000" >
<div class=tourBar id=tourBar style="" align=right > </div>
<table width=590 height="321" align=center cellpadding=0 cellspacing=0>
<tr>
<!-- leftside -->
<td width="100%" align=left valign=top>
<table width="618" cellpadding=2>
<tr>
<td colspan=2 class=whitehead>&nbsp;
<td width="115" align=left valign=bottom class=bodytext><font style="font-size: 1pt">&nbsp;</font></td>
</tr>
<tr>
<td width="590" align=left valign=top> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="590" height="320" id="panorama" align="">
<param name=movie value="media/panorama.swf?img_url=media/fr_mp.jpg&htmlWidth=590&htmlHeight=320&barY=298&flSpeed=.8">
<param name=quality value=high>
<param name=bgcolor value=#ffffff>
<embed src="media/panorama.swf?img_url=media/fr_mp.jpg&htmlWidth=590&htmlHeight=320&barY=298&flSpeed=.10" quality=high bgcolor=#ffffff width="590" height="320" name="panorama" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>
</object> <div class=labeltext align=right> <b></b></div></td>
<td width="25">&nbsp;</td>
<td class=bodytext valign=top>&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan=2>&nbsp; </td>
</tr>
</table>
</body>
</html>

TJ_Tigger
04-18-2004, 12:34 PM
Bruce,

Are you reading the text file to a string or to a table?

If string I would use String.Replace to replace that one occurance of the substring.

If you are reading to a table, you will have to enumerate the table to find the instance and then replace it.

for line,value in tablefromtextfile do
result = String.Find(value, "fr_mp.jpg", 1, false);
if result ~= -1 then --string was found
String.Replace(value, "fr_mp.jpg", replacementtext, false);
end
end
TextFile.WriteFromTable --output the table to a file where you want it to be.