Desmond
09-26-2003, 11:38 AM
<HTML> <HEAD> <TITLE>Reading Specific Lines from a Text File</TITLE> </HEAD> <BODY> <h3>Reading Specific Lines from a Text File</h3> <b>Document ID: IR10025</b> <hr> The information in this article applies to: <ul> <li>AutoPlay Media Studio 5.0 Professional Edition</li> </ul> <hr> <h3>SUMMARY</h3> <p>This article describes how to reboot the user's system. </p> <h3>DISCUSSION</h3> <p>To retrieve specific lines from a text file in AutoPlay Media Studio 5.0, use the ReadToTable action.<br> <br> As an example, we will read the file C:\test.txt into a table variable, and output the lines 4 through 10 to a paragraph object:<br> <br> Insert the following code into an event in your application:<code><pre>beginning_line = 4;
<br />end_line = 10;
<br />tabText = TextFile.ReadToTable("c:\\test.txt");
<br />strLinesOfText = ""; line = beginning_line;
<br />
<br />while line < (end_line + 1) do
<br /> strLinesOfText = strLinesOfText .. "\r\n" .. "Line " .. line .. ": " .. tabText[line] .. "\r\n"; line = line + 1;
<br />end
<br />
<br />Paragraph.SetText("Paragraph1", strLinesOfText);</pre></code>
<br /><h3>MORE INFORMATION</h3> <p>For more information please see the following topics in the AutoPlay Media Studio 5.0 help file:</p> <ul> <li><b>Program Reference | Actions | TextFile | TextFile.ReadToTable</b></li> </ul> <p>KEYWORDS: AutoPlay Media Studio 5.0, Actions, Text, File, Table, String, Read </p> <hr> <FONT SIZE=1> Last reviewed: September 26, 2003<br> Copyright © 2003 <A HREF="http://www.indigorose.com" target="blank">Indigo Rose Corporation</a>. All rights reserved.<br> </FONT> </BODY> </HTML>
<br />end_line = 10;
<br />tabText = TextFile.ReadToTable("c:\\test.txt");
<br />strLinesOfText = ""; line = beginning_line;
<br />
<br />while line < (end_line + 1) do
<br /> strLinesOfText = strLinesOfText .. "\r\n" .. "Line " .. line .. ": " .. tabText[line] .. "\r\n"; line = line + 1;
<br />end
<br />
<br />Paragraph.SetText("Paragraph1", strLinesOfText);</pre></code>
<br /><h3>MORE INFORMATION</h3> <p>For more information please see the following topics in the AutoPlay Media Studio 5.0 help file:</p> <ul> <li><b>Program Reference | Actions | TextFile | TextFile.ReadToTable</b></li> </ul> <p>KEYWORDS: AutoPlay Media Studio 5.0, Actions, Text, File, Table, String, Read </p> <hr> <FONT SIZE=1> Last reviewed: September 26, 2003<br> Copyright © 2003 <A HREF="http://www.indigorose.com" target="blank">Indigo Rose Corporation</a>. All rights reserved.<br> </FONT> </BODY> </HTML>