How do I... ?
AnswerList of Questions
Read Specific Lines from a Text File
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:
1. 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);
How do I... ?
AnswerList of Questions
Reboot the System
To reboot the user's system from your application:
1. Insert the following action into an event in your application:
System.Reboot();
Note: This action reboots the machine, with no user interaction required, and no warning given.