How do I...?

Read Specific Lines from a Text File

To retrieve specific lines from a text file in AutoPlay Media Studio 5.0, use the ReadToTable action.

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:

  1. Insert the following code into an event in your application:

beginning_line = 4;
end_line = 10;
tabText = TextFile.ReadToTable("c:\\test.txt");
strLinesOfText = "";
line = beginning_line;

while line < (end_line + 1) do
    strLinesOfText = strLinesOfText .. "\r\n" .. "Line " .. line .. ": " .. tabText[line] .. "\r\n";
    line = line + 1;
end

Paragraph.SetText("Paragraph1", strLinesOfText);


Applies to:

Professional Edition