Display a Partial Text File Using FSO

Display a Partial Text File Using FSO

This script reads specific lines of text from any text file and then stores the lines in an array that you can assign to a variable for data display.

<%Const ForReading = 1' The following line numbers will be read into the arrayDim myArr(4)myArr(0)="10"myArr(1)="12"myArr(2)="15"myArr(3)="17"' Counter used for array incrementi = 0' Create FSO Object & Set File to ReadSet objFSO = CreateObject("Scripting.FileSystemObject")Set objFile = objFSO.GetFile("C:inetpubwwwrootReadme.Txt")' Open file for reading.Set objTextFile = objFile.OpenAsTextStream(ForReading)' Loop Through TEXT File and Get Text to DisplayDo While objTextFile.AtEndOfStream <> True    CurrLine = objTextFile.Line    If Cstr(CurrLine) = Cstr(myArr(i)) Then	myArr(i)=UCASE(objTextFile.ReadLine)        i = i + 1    Else        CurrLine = objTextFile.ReadLine    End IfLoop' Set variablesLine10 = myArr(0)Line12 = myArr(1)Line15 = myArr(2)Line17 = myArr(3)' Close & DestroyobjTextFile.CloseSet objFSO = NothingSet objFile = Nothing' Display DataResponse.Write "Line 10 reads: " & Line10Response.Write "Line 12 reads: " & Line12Response.Write "Line 15 reads: " & Line15Response.Write "Line 17 reads: " & Line17%>
Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several