KB-64100: Returning a specific line in a text file (TXT) via E3.

Question:

How can I return the contents of a specific line in a TXT file?

Solution:

To do so, you must use the methods in FileSystemObject objects.

Example:

Const ForReading = 1

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("C:\Test.txt", ForReading)

For i = 1 to Screen.Item("SetPoint").Value-1
    f.ReadLine
Next

strLine = f.ReadLine
Screen.Item("Display").Value = strLine

f.Close

NOTE: If the number of the line selected in the SetPoint is higher than the number of lines in the file, a script error will be returned.

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *