AnswerList of Questions
To retrieve specific lines from a text file in AutoPlay Media Studio, 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:
Insert the following code into an event in your application:
-- Set the beginning and ending text line numbers
beginning_line = 4;
end_line = 10;
-- populate a table with the contents of a text file
tabText = TextFile.ReadToTable("c:\\test.txt");
-- Initialize variable strLinesOfText
strLinesOfText = "";
-- Set the current line number
line = beginning_line;
-- Loop through table until end condition is reached
while line < (end_line + 1) do
-- Append data to variable strLengthOfText
strLinesOfText = strLinesOfText .. "\r\n" .. "Line " .. line .. ": " .. tabText[line] .. "\r\n";
line = line + 1;
end
-- Output to user
Paragraph.SetText("Paragraph1", strLinesOfText);