IsEndOfLine Method

Applies to TestComplete 15.48, last modified on March 01, 2023

Description

Use the IsEndOfLine method to verify whether you are at the end of the current line.

Declaration

aqTextFileObj.IsEndOfLine()

aqTextFileObj An expression, variable or parameter that specifies a reference to an aqTextFile object
Result Boolean

Applies To

The method is applied to the following object:

Result Value

True if the end of the line has been reached, and False otherwise.

Example

The code below posts the first line of the specified file by letters to the test log.

JavaScript, JScript

function ReadLineByLetters()
{
  var sPath = "D:\\Files\\MyFile.txt";

   // Opens the specified file for reading
  var myFile = aqFile.OpenTextFile(sPath, aqFile.faRead, aqFile.ctANSI);

  // Posts the first line by letters to the test log
  while (! myFile.IsEndOfLine() )
    Log.Message(myFile.ReadString(1));

  // Closes the file
  myFile.Close();
}

Python

def ReadLineByLetters():
  sPath = "D:\\Files\\MyFile.txt"
  # Opens the specified file for reading 
  myFile = aqFile.OpenTextFile(sPath, aqFile.faRead, aqFile.ctANSI)
  # Posts the first line by letters to the test log
  while not myFile.IsEndOfLine():
    Log.Message(myFile.ReadString(1))
  # Closes the file 
  myFile.Close()

VBScript

Sub ReadLineByLetters
  sPath = "D:\Files\MyFile.txt"

   ' Opens the specified file for reading
  Set myFile = aqFile.OpenTextFile(sPath, aqFile.faRead, aqFile.ctANSI)

  ' Posts the first line by letters to the test log
  While Not myFile.IsEndOfLine()
    Log.Message(myFile.ReadString(1))
  WEnd

  ' Closes the file
  myFile.Close()
End Sub

DelphiScript

function ReadLineByLetters;
var sPath, myFile;
begin
  sPath := 'D:\Files\MyFile.txt';

   // Opens the specified file for reading
  myFile := aqFile.OpenTextFile(sPath, aqFile.faRead, aqFile.ctANSI);

  // Posts the first line by letters to the test log
  while (not myFile.IsEndOfLine() ) do
    Log.Message(myFile.ReadString(1));

  // Closes the file
  myFile.Close();
end;

C++Script, C#Script

function ReadLineByLetters()
{
  var sPath = "D:\\Files\\MyFile.txt";

   // Opens the specified file for reading
  var myFile = aqFile["OpenTextFile"]( sPath, aqFile["faRead"], aqFile["ctANSI"] );

  // Posts the first line by letters to the test log
  while (! myFile["IsEndOfLine"]() )
    Log["Message"]( myFile["ReadString"](1) );

  // Closes the file
  myFile["Close"]();
}

See Also

Working With Files From Scripts
IsEndOfFile Method

Highlight search results